|
| 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 | + types: [opened, synchronize, reopened, labeled, unlabeled] |
| 13 | + paths: |
| 14 | + - "frontend/src/views/**" |
| 15 | + - "frontend/src/components/**" |
| 16 | + - "frontend/src/console/**" |
| 17 | + - "frontend/src/layouts/**" |
| 18 | + |
| 19 | +permissions: read-all |
| 20 | + |
| 21 | +jobs: |
| 22 | + check-v1-frozen: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4.3.0 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: Fail if v1 UI files changed |
| 31 | + env: |
| 32 | + BASE_REF: ${{ github.event.pull_request.base.ref }} |
| 33 | + HAS_BYPASS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'allow-v1-changes') }} |
| 34 | + run: | |
| 35 | + git fetch --no-tags --depth=1 origin "$BASE_REF" |
| 36 | +
|
| 37 | + v1_files=$(git diff --name-only "origin/$BASE_REF...HEAD" -- \ |
| 38 | + "frontend/src/views/" \ |
| 39 | + "frontend/src/components/" \ |
| 40 | + "frontend/src/console/" \ |
| 41 | + "frontend/src/layouts/") |
| 42 | +
|
| 43 | + if [ -z "$v1_files" ]; then |
| 44 | + echo "No v1 UI files changed." |
| 45 | + exit 0 |
| 46 | + fi |
| 47 | +
|
| 48 | + echo "This PR modifies frozen v1 UI files:" |
| 49 | + echo "$v1_files" | sed 's/^/ - /' |
| 50 | + echo "" |
| 51 | +
|
| 52 | + if [ "$HAS_BYPASS_LABEL" = "true" ]; then |
| 53 | + echo "The 'allow-v1-changes' label is present; allowing v1 changes." |
| 54 | + exit 0 |
| 55 | + fi |
| 56 | +
|
| 57 | + echo "::error::The v1 UI (frontend/src/{views,components,console,layouts}) is frozen." |
| 58 | + echo "New frontend work must go in frontend/src/v2/." |
| 59 | + echo "For a sanctioned critical bug fix, add the 'allow-v1-changes' label to this PR." |
| 60 | + exit 1 |
0 commit comments