-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (66 loc) · 2.32 KB
/
check-drift.yml
File metadata and controls
75 lines (66 loc) · 2.32 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Drift check
on:
pull_request:
push:
branches: [main]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Scan for forbidden patterns
run: |
set -e
PATTERNS=(
'aeoess-private'
'/Users/tima'
'MODEL-CITIZEN-CANON'
'MODEL_CITIZEN_CANON'
'THE-SYNTHESIS'
'THE_SYNTHESIS'
'ERIK-NEWTON'
'ERIK_NEWTON'
'OPEN-COMMITMENTS'
'OPEN_COMMITMENTS'
'CC-PROMPT-TEMPLATES'
'CC_PROMPT_TEMPLATES'
'DAILY-UPDATE-RHYTHM'
'DAILY_UPDATE_RHYTHM'
'MUTUAL-MODE'
'MUTUAL_MODE'
'canary watch'
'UPDATE-PROPAGATION-SPEC'
'CONSILIUM-FORENSIC'
'CONSILIUM-BRIEFING'
'ROME-COMPLETE'
)
# Files we deliberately allow these patterns in (the workflow itself,
# the gitignore block listing the same patterns to keep files out,
# the propagate.mjs final-scan source, any other script that
# intentionally enumerates the patterns to check for them).
EXCLUDE_PATHS='(\.github/workflows/check-drift\.yml|\.gitignore|scripts/check-drift\.sh|scripts/propagate\.mjs)'
violations=0
for pat in "${PATTERNS[@]}"; do
# Search tracked files only, excluding self-references
hits=$(git ls-files | grep -v -E "$EXCLUDE_PATHS" | xargs grep -l -F "$pat" 2>/dev/null || true)
if [ -n "$hits" ]; then
echo "::error::Forbidden pattern '$pat' found in:"
echo "$hits" | sed 's/^/ /'
violations=$((violations + 1))
fi
# Also check filenames themselves
file_hits=$(git ls-files | grep -F "$pat" || true)
if [ -n "$file_hits" ]; then
echo "::error::Forbidden pattern '$pat' in filename(s):"
echo "$file_hits" | sed 's/^/ /'
violations=$((violations + 1))
fi
done
if [ "$violations" -gt 0 ]; then
echo ""
echo "::error::Drift check failed: $violations pattern violation(s)."
exit 1
fi
echo "✓ Drift check passed."