diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..3735fd2 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,46 @@ +name: Lint PR title + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + - reopened + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + pull-requests: read + +jobs: + lint: + name: Conventional commit title + runs-on: ubuntu-latest + steps: + - name: Lint PR title + uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Conventional commit types accepted in titles. Mirrors the set the + # PR labeler recognizes in .github/workflows/labeler.yml. + types: | + feat + fix + perf + refactor + revert + docs + ci + build + chore + test + style + # Subject must start lowercase and not end with a period. + subjectPattern: ^(?![A-Z])(?!.*\.$).+$ + subjectPatternError: | + The subject "{subject}" found in "{title}" must start with a + lowercase letter and must not end with a period.