-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from josegomezr/experiment_reusable_workflows
Reusable Workflow Experiment: Upstreaming commit message checks
- Loading branch information
Showing
2 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
40 changes: 21 additions & 19 deletions
40
.github/workflows/commit_message_checker.yml → ...workflows/base-commit-message-checker.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |