Skip to content

Commit

Permalink
chore: add action to check title prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
HerrCai0907 committed Apr 3, 2024
1 parent b640ff2 commit 7f67e10
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: PR

on:
pull_request:
types: [opened, edited, synchronize]

jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: Check PR Title Prefix
uses: actions/github-script@v7
with:
script: |
const titlePrefixes = ['feat', 'fix', 'break', 'chore'];
const title = context.payload.pull_request.title.toLowerCase();
const titleHasValidPrefix = titlePrefixes.some(prefix => title.startsWith(`${prefix}:`));
- if: failure()
uses: thollander/actions-comment-pull-request@v2
with:
message: |
"🚨 PR title does not meet the requirements. It must start with one of the following prefixes: 'feat:', 'fix:', 'chore:', 'break:'."
comment_tag: PR title check result

0 comments on commit 7f67e10

Please sign in to comment.