Skip to content

Commit

Permalink
feat: TitleLinter customized (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
alldoami authored Feb 1, 2022
1 parent c4b81e1 commit 39c7e20
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/titleLint.yml
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
regex: (feat|fix|docs|chore|style|refactor|perf|test): .*
# Validates PR title follows conventional commits
on:
pull_request:
types:
- edited
- opened
- synchronize
- reopened

jobs:
conventional_commit_title:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v5
with:
script: |
const validator = /^(chore|feat|fix|revert|docs|style)(\([a-z ]+\))?(!)?: (.)+$/
const title = context.payload.pull_request.title
const is_valid = validator.test(title)
if (!is_valid) {
const details = JSON.stringify({
title: title,
valid_syntax: validator.toString(),
})
core.setFailed(`Your pr title doesn't adhere to conventional commits syntax. See more details: ${details}`)
}

0 comments on commit 39c7e20

Please sign in to comment.