Skip to content

Instantly share code, notes, and snippets.

@vukhanhtruong
Last active December 1, 2021 02:56
Show Gist options
  • Save vukhanhtruong/ccc10a007a41f52eed6e3cb4927f40d1 to your computer and use it in GitHub Desktop.
Save vukhanhtruong/ccc10a007a41f52eed6e3cb4927f40d1 to your computer and use it in GitHub Desktop.
Github Actions for checking semantic commit message & task-id included
name: 'Semantic Commit Message Checker'
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Check valid types
uses: gsactions/commit-message-checker@v1
with:
pattern: '(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?:\s(\w+)'
error: 'Your commit message should match one of these types (build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test) in header.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check valid Task Id
uses: gsactions/commit-message-checker@v1
with:
pattern: '\s(TI(-\w+\b){0,}-\w+\b)$'
error: 'Your commit message must include Task-Id (e.g: TI-123abc) in footer.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment