-
Notifications
You must be signed in to change notification settings - Fork 17
46 lines (38 loc) · 1.16 KB
/
validate.yml
File metadata and controls
46 lines (38 loc) · 1.16 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
name: Validate PR
on:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check contributor permissions
id: check-permission
uses: actions-cool/check-user-permission@v2
with:
require: 'write'
- name: Validate external contributor changes
if: steps.check-permission.outputs.require-result == 'false'
run: |
FORBIDDEN_FILES=$(git diff --name-only origin/main...HEAD | grep -vE "^data/" || true)
if [ -n "$FORBIDDEN_FILES" ]; then
echo "❌ External contributors can only modify files in data/ folder"
echo ""
echo "Forbidden changes detected:"
echo "$FORBIDDEN_FILES"
exit 1
fi
echo "✅ PR only modifies allowed files in data/"
format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Check formatting
run: npx prettier --check .