From 9ca66912aadc30c716109f541470fa56efb2472c Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Mon, 10 Jul 2023 10:11:19 -0700 Subject: [PATCH] Add action to check for DO NOT MERGE commits --- .github/workflows/do_not_merge.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/do_not_merge.yaml diff --git a/.github/workflows/do_not_merge.yaml b/.github/workflows/do_not_merge.yaml new file mode 100644 index 000000000..559ec8716 --- /dev/null +++ b/.github/workflows/do_not_merge.yaml @@ -0,0 +1,27 @@ +name: "Check that there are no commits on the branch that should not be merged" +on: + push: + branches: + - main + pull_request: + +jobs: + do-not-merge-checker: + runs-on: ubuntu-latest + + steps: + - name: Check that there are no commits that should not be merged + uses: gsactions/commit-message-checker@v2 + with: + excludeDescription: "true" # optional: this excludes the description body of a pull request + excludeTitle: "true" # optional: this excludes the title of a pull request + checkAllCommitMessages: "true" # optional: this checks all commits associated with a pull request + accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true + # Check for message indicating that there is a commit that should + # not be merged. + pattern: ^(?!DO NOT MERGE) + flags: "i" + error: | + "This step failed because there is a commit containing the text + 'DO NOT MERGE'. Remove this commit from the branch before merging + or change the commit summary."