ci_: validate pr title (#5872)

This commit is contained in:
Igor Sirotin 2024-09-26 09:10:59 +01:00 committed by GitHub
parent d794e43347
commit a1c6d7f333
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 3 deletions

View File

@ -9,8 +9,8 @@ on:
- labeled
- unlabeled
jobs:
main:
name: Validate format
lint_pr_commits:
name: Validate commit messages
runs-on: ubuntu-latest
permissions:
pull-requests: write
@ -23,6 +23,7 @@ jobs:
- name: Check commit message
id: check_commit_message
if: always()
run: |
set +e
@ -50,7 +51,6 @@ jobs:
echo "error_message<<$EOF" >> "$GITHUB_ENV"
echo "${invalid_commit_messages}" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
fi
- name: "Publish failed commit messages"

21
.github/workflows/pr-lint.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: "Conventional Commits"
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
jobs:
lint_pr_title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Keep regex in sync with ./_assets/scripts/parse_commits.sh#L25
headerPattern: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(\_|!): (.*)$'
headerPatternCorrespondence: type, scope, breaking, subject