-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: conventional commit checks (#316)
Add a check to ensure that PR title follow the [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) format. Copied from https://github.com/dfinity/canbench/blob/255a422c02c3856195f04801efda7350cc061da3/.github/workflows/ci.yml.
- Loading branch information
1 parent
2b8be23
commit 71f2fe7
Showing
2 changed files
with
39 additions
and
3 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
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,39 @@ | ||
name: PR title format | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
# When getting Rust dependencies, retry on network error: | ||
CARGO_NET_RETRY: 10 | ||
# Use the local .curlrc | ||
CURL_HOME: . | ||
TITLE: ${{ github.event.pull_request.title }} | ||
jobs: | ||
check: | ||
name: conventional-pr-title:required | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Conventional commit patterns: | ||
# verb: description | ||
# verb!: description of breaking change | ||
# verb(scope): Description of change to $scope | ||
# verb(scope)!: Description of breaking change to $scope | ||
# verb: feat, fix, ... | ||
# scope: refers to the part of code being changed. E.g. " (accounts)" or " (accounts,canisters)" | ||
# !: Indicates that the PR contains a breaking change. | ||
- run: | | ||
if [[ "$TITLE" =~ ^(feat|fix|chore|build|ci|docs|style|refactor|perf|test)(\([-a-zA-Z0-9,]+\))?\!?\: ]]; then | ||
echo pass | ||
else | ||
echo "PR title does not match conventions" | ||
exit 1 | ||
fi |