Skip to content

Commit 433679c

Browse files
committed
new file: .github/workflows/00_Validation.yml
deleted: .github/workflows/00_vetting.yml
1 parent 40f666e commit 433679c

File tree

2 files changed

+40
-31
lines changed

2 files changed

+40
-31
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: A. PR Validation
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, edited, synchronize, review_requested]
6+
7+
jobs:
8+
check-staging-only:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout PR
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Ensure only staging files changed
17+
shell: bash
18+
run: |
19+
set -euo pipefail
20+
21+
# Fetch base branch
22+
git fetch --no-tags --prune origin "${{ github.base_ref }}"
23+
base_ref="origin/${{ github.base_ref }}"
24+
25+
# List changed files
26+
changed="$(git diff --name-only "${base_ref}"...HEAD || true)"
27+
28+
# Only allow changes in staging/ and docs/ (or other allowed directories)
29+
allowed_regex='^(staging|docs)(/|$)'
30+
31+
# Detect changes outside allowed paths
32+
unvetted="$(printf '%s\n' "$changed" | grep -vE "$allowed_regex" || true)"
33+
34+
if [[ -n "$unvetted" ]]; then
35+
echo "❌ ERROR: PR contains changes outside allowed directories (staging/docs):"
36+
printf '%s\n' "$unvetted"
37+
exit 1
38+
fi
39+
40+
echo "✅ Only allowed directories modified. PR passes validation."

.github/workflows/00_vetting.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)