Skip to content

Commit 70cddb8

Browse files
committed
ci: fail PRs that modify the frozen frontend v1 UI
The v1 UI (frontend/src/{views,components,console,layouts}) is frozen and slated for deletion; new frontend work belongs in frontend/src/v2/. This workflow fails any PR that touches v1 UI files, with an "allow-v1-changes" label escape hatch for sanctioned critical bug fixes. Generated-By: PostHog Code Task-Id: 55fda8a5-426e-479d-8221-26a8437e57bb
1 parent dea86e3 commit 70cddb8

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Frontend v1 Frozen Check
2+
3+
# The v1 UI is frozen and slated for deletion. New frontend work goes in
4+
# frontend/src/v2/. This check fails if a PR modifies any v1 UI code so the
5+
# freeze is enforced automatically.
6+
#
7+
# Sanctioned exception: for a critical v1 bug fix, add the "allow-v1-changes"
8+
# label to the PR to bypass this check.
9+
10+
on:
11+
pull_request:
12+
paths:
13+
- "frontend/src/views/**"
14+
- "frontend/src/components/**"
15+
- "frontend/src/console/**"
16+
- "frontend/src/layouts/**"
17+
18+
permissions: read-all
19+
20+
jobs:
21+
check-v1-frozen:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4.3.0
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Fail if v1 UI files changed
30+
env:
31+
BASE_REF: ${{ github.event.pull_request.base.ref }}
32+
HAS_BYPASS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'allow-v1-changes') }}
33+
run: |
34+
git fetch --no-tags --depth=1 origin "$BASE_REF"
35+
36+
v1_files=$(git diff --name-only "origin/$BASE_REF...HEAD" -- \
37+
"frontend/src/views/" \
38+
"frontend/src/components/" \
39+
"frontend/src/console/" \
40+
"frontend/src/layouts/")
41+
42+
if [ -z "$v1_files" ]; then
43+
echo "No v1 UI files changed."
44+
exit 0
45+
fi
46+
47+
echo "This PR modifies frozen v1 UI files:"
48+
echo "$v1_files" | sed 's/^/ - /'
49+
echo ""
50+
51+
if [ "$HAS_BYPASS_LABEL" = "true" ]; then
52+
echo "The 'allow-v1-changes' label is present; allowing v1 changes."
53+
exit 0
54+
fi
55+
56+
echo "::error::The v1 UI (frontend/src/{views,components,console,layouts}) is frozen."
57+
echo "New frontend work must go in frontend/src/v2/."
58+
echo "For a sanctioned critical bug fix, add the 'allow-v1-changes' label to this PR."
59+
exit 1

0 commit comments

Comments
 (0)