Skip to content

Commit

Permalink
chore: modify check-pr-title action
Browse files Browse the repository at this point in the history
  • Loading branch information
chunshao90 committed Apr 22, 2024
1 parent f72533c commit 8de8893
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
15 changes: 0 additions & 15 deletions .github/pr-title-checker-config.json

This file was deleted.

27 changes: 14 additions & 13 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,23 @@
# specific language governing permissions and limitations
# under the License.

name: "PR Title Checker"
name: Check PR Title

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- labeled
- unlabeled
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
check:
check-pr-title:
runs-on: ubuntu-latest
steps:
- uses: thehanimo/pr-title-checker@v1.4.1
- name: Check Title
uses: actions/github-script@v5
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/pr-title-checker-config.json
script: |
const title = context.payload.pull_request.title;
const regex = /^(feat|fix|docs|refactor|chore)(\(.+\))?!?: .+$/;
if (!regex.test(title)) {
core.setFailed('PR title does not follow the convention, the pattern: ^(feat|fix|docs|refactor|chore)(\(.+\))?!?: .+$');
}
github-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8de8893

Please sign in to comment.