Skip to content

Commit

Permalink
ci: Check pull request titles for the commit convention format (#10334)
Browse files Browse the repository at this point in the history
ci: check pull request titles
  • Loading branch information
Jiralite committed Jun 8, 2024
1 parent 757bed0 commit 3cdddbe
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pr-triage.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
name: 'PR Triage'
on:
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
jobs:
pr-triage:
name: PR Triage
runs-on: ubuntu-latest
steps:
- name: Automatically label PR
uses: actions/labeler@v5
if: github.event.action != 'edited'
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
sync-labels: true

- name: Validate commit convention
if: github.event.action != 'synchronize'
run: |
TITLE="${{ github.event.pull_request.title }}"
REGEX="^(revert: )?(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|types|wip)(\\(.+\\))?: .{1,72}$"
echo "Title: \"$TITLE\""
if [[ ! "$TITLE" =~ $REGEX ]]; then
exit 1
fi

0 comments on commit 3cdddbe

Please sign in to comment.