Repository navigation
98 lines (86 loc) · 3.52 KB
/
Copy pathsurface-diff.yml
File metadata and controls
98 lines (86 loc) · 3.52 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: public-surface-diff
# Public surface observation remains non-blocking pending #309. It runs for
# release tags, or on a PR explicitly labeled `surface-diff-gate`/`ci:full`.
# Ordinary PRs schedule no runner for this informational lane.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
push:
tags: ['v*']
permissions:
contents: read
jobs:
classify:
name: classify changes
runs-on: ubuntu-latest
timeout-minutes: 10
if: >-
github.event_name != 'pull_request' ||
(github.event.pull_request.draft == false &&
(contains(github.event.pull_request.labels.*.name, 'surface-diff-gate') ||
contains(github.event.pull_request.labels.*.name, 'ci:full')))
outputs:
needs_surface: ${{ steps.decide.outputs.needs_surface }}
reason: ${{ steps.decide.outputs.reason }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.9.7"
- name: Self-check the classifier
run: >-
deno test --allow-read --allow-write --allow-env
.github/scripts/ci-classify-changes.test.ts
- name: Compute changed files (merge-base diff, rename-aware)
if: github.event_name == 'pull_request'
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
CHANGED_NAME_STATUS_FILE: ${{ runner.temp }}/changed-name-status.txt
# `--name-status -M` so renames/copies report BOTH sides (see
# e2e-cli.yml).
run: git diff --name-status -M "$BASE_SHA...$HEAD_SHA" > "$CHANGED_NAME_STATUS_FILE"
# No root deno.json extraction here: `needs_surface` is independent of
# the tasks-only discrimination (the root config never lives under
# `packages/`), and the missing-content default is the conservative one.
- name: Decide run/skip
id: decide
env:
EVENT_NAME: ${{ github.event_name }}
CHANGED_NAME_STATUS_FILE: ${{ runner.temp }}/changed-name-status.txt
PR_LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
run: deno run --allow-read --allow-write --allow-env .github/scripts/ci-classify-changes.ts
surface-diff:
needs: classify
# Only release or explicitly opted-in PR runs reach this lane. Within an
# applicable run, classifier failure is fail-closed.
if: ${{ !cancelled() && needs.classify.result != 'skipped' }}
runs-on: ubuntu-latest
timeout-minutes: 20
env:
RUN: ${{ needs.classify.result != 'success' || needs.classify.outputs.needs_surface == 'true' }}
SKIP_REASON: ${{ needs.classify.outputs.reason }}
steps:
- name: Skipped by policy
if: env.RUN != 'true'
# REASON contains raw changed-file names — never interpolate it into
# shell source; pass via env and print with printf.
run: |
printf '::notice::surface-diff skipped by policy. %s\n' "$SKIP_REASON"
- name: Checkout
if: env.RUN == 'true'
uses: actions/checkout@v5
- name: Setup Deno
if: env.RUN == 'true'
uses: denoland/setup-deno@v2
with:
deno-version: "2.9.7"
# Issue #309 remains open and explicitly owns the flip to enforcement.
- name: Observe public API drift (non-blocking pending #309)
if: env.RUN == 'true'
run: deno task surface:diff
continue-on-error: true