-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ayushrakesh/check-PR
feat: Github action to check PR's title format.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 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,27 @@ | ||
name: PR Title Lint | ||
|
||
on: | ||
pull_request: | ||
types: [opened, edited, synchronize] | ||
|
||
jobs: | ||
pr-title-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Run PR title linter | ||
run: | | ||
TITLE=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH") | ||
if [[ ! "$TITLE" =~ ^(fix|feat|docs|style|refactor|perf|test|chore):\ .{1,50}$ ]]; then | ||
echo "Invalid PR title: $TITLE" | ||
echo "PR titles must start with one of the following types: fix, feat, docs, style, refactor, perf, test, chore." | ||
echo "Followed by a colon and space, and a brief description (1-50 characters)." | ||
exit 1 | ||
fi |
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