Skip to content

Commit

Permalink
Add action to check for DO NOT MERGE commits
Browse files Browse the repository at this point in the history
* Checks summary for DO NOT MERGE
* Checks requirements.txt for ticket branches
  • Loading branch information
timj committed Jul 10, 2023
1 parent 40f6534 commit b46df0a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/do_not_merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Check commits can 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: ^(?!XDO 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."
- uses: actions/checkout@v3

- name: Check requirements.txt for branches
run: >
if $(grep tickets/DM- requirements.txt > /dev/null)
then;
echo Tickets found in requirements:;
grep -n tickets/DM- requirements.txt;
exit 1;
fi

0 comments on commit b46df0a

Please sign in to comment.