From f658ef66eeb21903f09fe4c39160ea4a734a97bc Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani <45800463+rchincha@users.noreply.github.com> Date: Fri, 30 Sep 2022 16:08:23 -0700 Subject: [PATCH] style(ci/cd): add a commit msg style checker (#796) https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary The commit message should be structured as follows: [optional scope]: [optional body] [optional footer] Signed-off-by: Ramkumar Chinchani --- .github/workflows/commit-msg.yaml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/commit-msg.yaml diff --git a/.github/workflows/commit-msg.yaml b/.github/workflows/commit-msg.yaml new file mode 100644 index 00000000..b240aaca --- /dev/null +++ b/.github/workflows/commit-msg.yaml @@ -0,0 +1,33 @@ +name: 'Check commit message style' +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + push: + branches: + - main + +jobs: + check-commit-message-style: + name: Check commit message style + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Check Commit Type + uses: gsactions/commit-message-checker@v1 + with: + pattern: '^((build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.+\))?(!)?(: (.*\s*)*))' + flags: 'gm' + error: 'Your first line has to the Conventional Commits specification.' + - name: Check Line Length + uses: gsactions/commit-message-checker@v1 + with: + pattern: '^[^#].{74}' + error: 'The maximum line length of 74 characters is exceeded.' + excludeDescription: 'true' # optional: this excludes the description body of a pull request + excludeTitle: 'true' # optional: this excludes the title of a pull request + checkAllCommitMessages: 'false'