Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint-conventional-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 🔄 Lint | Conventional Commits

on:
pull_request:
types: [opened, edited]
branches: [main]

env:
GH_TOKEN: ${{ github.token }}
permissions:
pull-requests: write
jobs:
check-pr-name:
runs-on: ubuntu-latest
steps:
# Low-tech linter to avoid squashing commits into non-semantic conventional commit by addressing the most common cause
- name: Assert PR name adhering to conventional commits
run: |
pr_title_json=$(gh pr --repo ${{ github.repository }} view ${{ github.event.number }} --json title)
echo "${pr_title_json}" |
jq --args '.title | test("\\w+: \\w+")' -e 1 || {
pr_title=$(echo "${pr_title_json}" | jq -r '.title')
gh pr --repo ${{ github.repository }} comment ${{ github.event.number }} \
--body "PR title '${pr_title}' does not adhere to conventional commits. Change PR title to ensure that the suggested squash commit follows the conventions and thus ends up in the changelog."
exit 1
}
Loading