Skip to content
Open
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
31 changes: 31 additions & 0 deletions .github/workflows/block-remove-before-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Block remove-before-merge paths"

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

permissions:
pull-requests: read

jobs:
check-paths:
name: "No remove-before-merge directories"
runs-on: ubuntu-latest
steps:
- name: Check for remove-before-merge paths in PR
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
FILES=$(gh api repos/$REPO/pulls/$PR_NUMBER/files --paginate --jq '.[].filename')
BLOCKED=$(echo "$FILES" | grep -E '(^|/)[-a-zA-Z0-9_]+-remove-before-merge(/|$)' || true)
if [ -n "$BLOCKED" ]; then
echo "::error::This PR contains files under a 'remove-before-merge' directory. Remove them before merging."
echo ""
echo "Offending paths:"
echo "$BLOCKED"
exit 1
fi
echo "No remove-before-merge paths found. ✅"
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Loading