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

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

Comment thread
Copilot marked this conversation as resolved.
jobs:
check-paths:
name: "No remove-before-merge directories"
runs-on: ubuntu-latest
Comment thread
edburns marked this conversation as resolved.
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. ✅"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Loading