-
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.
Reusable Workflow Experiment: Upstreaming commit message checks
- Bringing checks from os-autoinst/openQA#5343. - Setting up reusable workflows [0]. [0]: https://docs.github.com/en/actions/using-workflows/reusing-workflows
- Loading branch information
1 parent
e555e72
commit 96cf0da
Showing
2 changed files
with
40 additions
and
11 deletions.
There are no files selected for viewing
36 changes: 25 additions & 11 deletions
36
.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,41 +1,55 @@ | ||
--- | ||
# https://github.com/marketplace/actions/gs-commit-message-checker | ||
name: 'Commit Message Check' | ||
# yamllint disable-line rule:truthy | ||
on: [push, pull_request] | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
accessToken: | ||
required: true | ||
|
||
jobs: | ||
check-commit-message: | ||
base-check-commit-message: | ||
name: Check Commit Message | ||
uses: gsactions/commit-message-checker@v2 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Subject Begining | ||
uses: gsactions/commit-message-checker@v1 | ||
uses: gsactions/commit-message-checker@v2 | ||
with: | ||
pattern: '^([A-Z]|\S+:)' | ||
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 | ||
accessToken: ${{ secrets.accessToken }} # only required if checkAllCommitMessages is true | ||
- name: Check Subject Ending | ||
uses: gsactions/commit-message-checker@v2 | ||
with: | ||
pattern: '^.+(?<!\.)(\n|$)' | ||
flags: 'g' | ||
error: 'The subject cannot not end with a dot.' | ||
excludeDescription: 'true' | ||
excludeTitle: 'true' | ||
checkAllCommitMessages: 'true' | ||
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: | ||
call-check-commit-message: | ||
uses: ./.github/workflows/base-commit-message-checker.yml | ||
secrets: | ||
accessToken: "${{ secrets.GITHUB_TOKEN }}" |