-
Notifications
You must be signed in to change notification settings - Fork 13
ci: prevent merge by commit message #1830
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
base: main
Are you sure you want to change the base?
Conversation
In addition to the do-not-merge label, this prevents merging commits that start their subject with one of the following phrases: * `DO NOT MERGE` * `DNM` * `draft`
72cdb9d to
9392b09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be renamed to prevent_accidental_merge.yml or similar
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | ||
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| run: | | ||
| if ! git log --pretty=format:"%s" "${BASE_SHA}..${HEAD_SHA}" | grep -E "^(DNM|DO NOT MERGE|draft)"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ! git log --pretty=format:"%s" "${BASE_SHA}..${HEAD_SHA}" | grep -E "^(DNM|DO NOT MERGE|draft)"; then | |
| if ! git log --pretty=format:"%s" "${BASE_SHA}..${HEAD_SHA}" | grep -iE "^(dnm|do not merge|draft|temp)"; then |
(i flag for robustness, temp for... personal reasons, feel free to ignore 😆)
Did that happen before?
usually such labels would at least go into [ ], I would add |
I use
I can relax the regex a bit. |
In addition to the do-not-merge label, this prevents merging commits that start their subject with one of the following phrases:
DO NOT MERGEDNMdraftExample failure: https://github.com/edgelesssys/contrast/actions/runs/18350842068/job/52270109970?pr=1830