Skip to content

Commit

Permalink
ci: add GitHub Action to enforce PR title format
Browse files Browse the repository at this point in the history
  • Loading branch information
Junjiequan committed Jul 31, 2024
1 parent a294b62 commit 52be015
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"LABEL": {
"name": ""
},
"CHECKS": {
"NOTE": "You can test the regex here: https://regex101.com/r/nDeps5/1",
"regexp": "(^(?<type>build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|BREAKING CHANGE)(?<scope>\\([\\w\\s*-]+\\))?(?<breaking_change>!?): (?<body>([a-z]).+[^.|\\s])$)",
"regexpFlags": "gm"
},
"MESSAGES": {
"success": "All OK",
"failure": "PR title not following the semantic-release guidelines. Please check https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines for more information.",
"notice": ""
}
}
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions .github/workflows/pr-title-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: PR Title Checker

on:
pull_request:
branches:
- master
types:
- opened
- edited
- synchronize
- labeled
- unlabeled

jobs:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/pr-title-checker-config.json #(optional. defaults to .github/pr-title-checker-config.json)

0 comments on commit 52be015

Please sign in to comment.