-
Notifications
You must be signed in to change notification settings - Fork 439
37 lines (31 loc) · 1.21 KB
/
block-paths.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Block Changes
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
check-blocked-paths:
name: Check for blocked path changes
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for blocked path changes
run: |
BLOCKED_PATHS=(
"packages/akamai/data_stream/siem/_dev/test/pipeline/"
"packages/cisco_ise/data_stream/log/_dev/test/pipeline/"
)
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
# Check if any blocked path is in the changed files.
for blocked_path in "${BLOCKED_PATHS[@]}"; do
if echo "$CHANGED_FILES" | grep -q "^$blocked_path"; then
msg="❌ ERROR: Changes to files in '$blocked_path' are currently not allowed! See @norrietaylor for details."
echo "$msg"
echo "$msg" >> $GITHUB_STEP_SUMMARY
exit 1
fi
done
echo "✅ No blocked paths were modified."
echo "✅ No blocked paths were modified." >> $GITHUB_STEP_SUMMARY