Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commit check workflow #13

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/commit-check-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Commit Message Check
run-name: ${{ format('{0} triggered by {1} on {2} {3}', github.workflow, (github.event_name == 'workflow_dispatch' && format('user {0}', github.actor) || format('{0} event', github.event_name) ), github.repository, github.ref_name) }}
on:
pull_request:

jobs:
CheckCommitMessages:
name: Check Commit Messages
permissions:
contents: read
uses: ./.github/workflows/shared-ext-commit-check-workflow.yml

49 changes: 49 additions & 0 deletions .github/workflows/shared-ext-commit-check-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Shared Commit Message Check Workflow
on:
# NOTE: This shared workflow assumes it is only called on pull_request events
workflow_call:

jobs:
CheckCommitMessages:
permissions:
contents: read
runs-on: ubuntu-22.04
steps:
- name: Check out PR code
uses: actions/checkout@v3
with:
fetch-depth: ${{github.event.pull_request.commits}} # only checkout commits from this PR
ref: ${{ github.ref }}

- name: Check PR commit messages don't start with 'FIXUP'
run: "[ $(git log --grep '^FIXUP' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'SQUASH'
run: "[ $(git log --grep '^SQUASH' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'AMEND'
run: "[ $(git log --grep '^AMEND' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'REWORD'
run: "[ $(git log --grep '^REWORD' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'DONOTMERGE'
run: "[ $(git log --grep '^DONOTMERGE' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'WIP'
run: "[ $(git log --grep '^WIP' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with 'TEMP'
run: "[ $(git log --grep '^TEMP' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with '!fixup'
run: "[ $(git log --grep '^!fixup' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with '!squash'
run: "[ $(git log --grep '^!squash' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with '!amend'
run: "[ $(git log --grep '^!amend' | wc -c) -eq 0 ]"

- name: Check PR commit messages don't start with '!reword'
run: "[ $(git log --grep '^!reword' | wc -c) -eq 0 ]"