Skip to content

Commit

Permalink
Merge pull request #28 from josegomezr/experiment_reusable_workflows
Browse files Browse the repository at this point in the history
Reusable Workflow Experiment: Upstreaming commit message checks
  • Loading branch information
mergify[bot] authored Oct 25, 2023
2 parents 1b05ad5 + d23cda4 commit 0cfcdb3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
---
# https://github.com/marketplace/actions/gs-commit-message-checker
name: 'Commit message check'
# yamllint disable-line rule:truthy

on:
pull_request:
push:
branches:
- '!master' # we must not fix commit messages when they already reached master
workflow_call:
secrets:
accessToken:
required: true

jobs:
check-commit-message:
base-check-commit-message:
name: Check commit message
runs-on: ubuntu-latest
steps:
- name: Check subject beginning
uses: gsactions/commit-message-checker@v1
uses: gsactions/commit-message-checker@v2
with:
pattern: '^([A-Z]|[A-Za-z0-9_/.\-\s]+:|git subrepo pull)'
pattern: '^([A-Z]|\S+:|git subrepo pull)'
flags: 'g'
error: 'The subject does not start with a capital or tag.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
accessToken: ${{ secrets.accessToken }}

- name: Check subject line length
uses: gsactions/commit-message-checker@v1
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.{1,72}(\n|$)'
flags: 'g'
error: 'The maximum subject line length of 72 characters is exceeded.'
excludeDescription: 'true' # excludes the description body of a pull request
excludeTitle: 'true' # excludes the title of a pull request
checkAllCommitMessages: 'true' # checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # only required if checkAllCommitMessages is true
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.accessToken }}

- name: Check subject ending
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.+(?<!\.)(\n|$)'
flags: 'g'
error: 'The subject cannot end with a dot.'
error: 'The subject cannot not end with a dot.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
accessToken: ${{ secrets.accessToken }}

- name: Check empty line
uses: gsactions/commit-message-checker@v1
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.*(\n\n|$)'
flags: 'g'
error: 'No newline between title and description.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
accessToken: ${{ secrets.accessToken }}
15 changes: 15 additions & 0 deletions .github/workflows/commit-message-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: 'Commit message check'

on:
pull_request:
push:
branches:
# we must not fix commit messages when they already reached master
- '!master'

jobs:
check-commit-message:
secrets:
accessToken: "${{ secrets.GITHUB_TOKEN }}"
uses: ./.github/workflows/base-commit-message-checker.yml

0 comments on commit 0cfcdb3

Please sign in to comment.