Skip to content
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
21 changes: 21 additions & 0 deletions .github/workflows/check-do-not-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Do Not Merge

on:
pull_request:
branches:
- main
types: [opened, reopened, labeled, unlabeled]

jobs:

check-do-not-merge:
runs-on: ubuntu-latest
steps:
- name: Block merge if do-not-merge label is present
env:
HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'do-not-merge') }}
run: |
if [ "$HAS_LABEL" = "true" ]; then
echo "::error::PR has the 'do-not-merge' label. Remove it before merging."
exit 1
fi
24 changes: 24 additions & 0 deletions .github/workflows/check-fixup-commits.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Fixup Commits

on:
pull_request:
branches:
- main

jobs:

check-fixup-commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for fixup or squash commits
run: |
git fetch origin ${{ github.base_ref }}
COMMITS=$(git log --oneline "origin/${{ github.base_ref }}..HEAD" --grep="^fixup!" --grep="^squash!" --format="%h %s")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do we need to check for 'squash!' in the commit message? (I don't see it being used). We can skip if it is not the convention.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to keep a squash! check too.

if [ -n "$COMMITS" ]; then
echo "::error::PR contains fixup/squash commits that must be squashed before merging:"
echo "$COMMITS"
exit 1
fi
Loading