-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(ci): lint commits in pull requests
Prevent the merging of unconventional commits into the master branch. Lint commits made directly onto the master branch. Issues: #18
- Loading branch information
1 parent
7d57c1f
commit ca239c2
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: Build | ||
|
||
on: | ||
pull_request: {} | ||
|
||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
commitlint: | ||
name: Commit Lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the codebase | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21 | ||
|
||
- name: Install Node modules | ||
run: npm install | ||
|
||
- name: Check program versions | ||
run: | | ||
node --version | ||
npm --version | ||
npm run commitlint -- --version | ||
- name: Validate last commit | ||
if: github.event_name == 'push' | ||
run: npm run commitlint -- --from=HEAD~1 --to=HEAD --verbose | ||
|
||
- name: Validate commits in pull request | ||
if: github.event_name == 'pull_request' | ||
run: >- | ||
npm run commitlint -- | ||
--from=${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} | ||
--to=${{ github.event.pull_request.head.sha }} | ||
--verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run commitlint ${1} | ||
npm run lint-commit-msg ${1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters