Skip to content

Commit

Permalink
ci: add PR title validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Feb 12, 2025
1 parent 8270554 commit c61c147
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# see https://github.com/srvaroa/labeler
version: 1
issues: False
labels:
- label: "bug"
title: "^fix(\\(.*\\))?:.*"
- label: "dependencies"
title: "^deps(\\(.*\\))?:.*"
- label: "documentation"
title: "^docs(\\(.*\\))?:.*"
- label: "enhancement"
title: "^(enh|feat)(\\(.*\\))?:.*"
- label: "work-in-progress"
title: "^WIP:.*"
mergeable: false
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:
- '.github/workflows/codeql-analysis.yml'
- '.github/workflows/stale.yml'
- '.github/workflows/update-python-deps.yml'
- '.github/workflows/validate-pr.yml'
pull_request:
paths-ignore:
- '**/*.md'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- '.github/workflows/build.yml'
- '.github/workflows/stale.yml'
- '.github/workflows/update-python-deps.yml'
- '.github/workflows/validate-pr.yml'
pull_request:
paths-ignore:
- '**/*.md'
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
name: "Validate PR Title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

jobs:
build:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Validate semantic PR title"
uses: amannn/action-semantic-pull-request@v5 # https://github.com/amannn/action-semantic-pull-request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://mazer.dev/en/git/best-practices/git-semantic-commits/
# https://github.com/commitizen/conventional-commit-types/blob/master/index.json
types: |
build
ci
chore
docs
fix
enh
feat
refact
revert
perf
style
test
scopes: |
deps
i18n
requireScope: false

- name: "Label PR"
uses: srvaroa/labeler@v1.13.0 # https://github.com/srvaroa/labeler
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit c61c147

Please sign in to comment.