Skip to content

Commit

Permalink
chore: encourage use of Conventional Commits
Browse files Browse the repository at this point in the history
Conventional Commits make release notes easier to read
because commits can be sorted by type

[#187721512](https://www.pivotaltracker.com/story/show/187721512)
  • Loading branch information
blgm committed Jun 28, 2024
1 parent 9abc09b commit 8718df1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/conventional-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Conventional Commit Check

on: [pull_request]

jobs:
conventional-commit:
runs-on: ubuntu-latest
steps:
- name: Check
uses: actions/github-script@v7
with:
script: |
const {data: pr} = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
const allowed = ["feat\\!", "feat", "fix", "chore", "docs", "build", "test", "revert"]
const re = new RegExp(`^(` + allowed.join('|') + `)(\\(\\w+\\))?: `)
const title = pr['title']
if (!re.test(title)) {
throw new Error(`PR title "${title}" does not match conventional commits filter: ${re}`)
}

0 comments on commit 8718df1

Please sign in to comment.