1
0

pr-title.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: Lint PR Title
  2. # GitHub uses the pull request title as the commit subject when "Squash and
  3. # merge" is used. When the repo is configured for squash-merge with the PR
  4. # title as the commit title, individual commits on a PR branch are discarded
  5. # by the squash, so this workflow — which validates the PR title against the
  6. # Conventional Commits spec — is the sole enforcement point for the format of
  7. # the commit that lands on main.
  8. on:
  9. pull_request_target:
  10. types:
  11. - opened
  12. - edited
  13. - synchronize
  14. - reopened
  15. permissions:
  16. pull-requests: read
  17. jobs:
  18. lint:
  19. name: Validate PR Title
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
  23. env:
  24. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  25. with:
  26. # Conventional Commits types accepted by the commitizen commit-msg hook.
  27. types: |
  28. build
  29. chore
  30. ci
  31. docs
  32. feat
  33. fix
  34. perf
  35. refactor
  36. revert
  37. style
  38. test
  39. requireScope: false
  40. # Subject (text after the type/scope) must start lowercase.
  41. subjectPattern: ^(?![A-Z]).+$
  42. subjectPatternError: |
  43. The subject "{subject}" found in the pull request title "{title}"
  44. didn't match the configured pattern. Please ensure that the subject
  45. doesn't start with an uppercase character.