@@ -48,11 +48,55 @@ jobs:
4848 >> "$GITHUB_OUTPUT"
4949 fi
5050
51+ # Release-sync PRs copy already-published generated outputs and consume the
52+ # frozen Changesets. They cannot add a new Changeset, so the required lint
53+ # context runs the trusted release-sync validator instead.
54+ - name : Detect the release-sync branch contract
55+ if : github.event_name == 'pull_request'
56+ id : release-sync-scope
57+ env :
58+ SYNC_BRANCH : ${{ github.head_ref }}
59+ run : |
60+ required=false
61+ case "$SYNC_BRANCH" in
62+ chore/sync-v*-to-main)
63+ VERSION=${SYNC_BRANCH#chore/sync-v}
64+ VERSION=${VERSION%-to-main}
65+ if printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
66+ required=true
67+ fi
68+ ;;
69+ esac
70+ echo "required=$required" >> "$GITHUB_OUTPUT"
71+
72+ - name : Validate release sync in required lint
73+ if : github.event_name == 'pull_request' && steps.release-sync-scope.outputs.required == 'true'
74+ env :
75+ SYNC_BRANCH : ${{ github.head_ref }}
76+ run : |
77+ set -eu
78+ VERSION=${SYNC_BRANCH#chore/sync-v}
79+ VERSION=${VERSION%-to-main}
80+ git fetch origin main 'refs/tags/v*:refs/tags/v*' '+refs/heads/release/v*:refs/remotes/origin/release/v*'
81+ TRUSTED_POLICY="$RUNNER_TEMP/release-policy"
82+ mkdir -p "$TRUSTED_POLICY/scripts/release" "$TRUSTED_POLICY/scripts/lib"
83+ git show origin/main:scripts/release/active-release.mjs \
84+ > "$TRUSTED_POLICY/scripts/release/active-release.mjs"
85+ git show origin/main:scripts/lib/workspace-globs.mjs \
86+ > "$TRUSTED_POLICY/scripts/lib/workspace-globs.mjs"
87+ VALIDATOR="$TRUSTED_POLICY/scripts/release/active-release.mjs"
88+ ACTIVE_BRANCHES=$(node "$VALIDATOR" list-active --root "$GITHUB_WORKSPACE")
89+ node "$VALIDATOR" validate-sync \
90+ --root "$GITHUB_WORKSPACE" \
91+ --base origin/main \
92+ --release-ref "v$VERSION" \
93+ --active-branches "$ACTIVE_BRANCHES"
94+
5195 # A change that ships to consumers names its package in a Changeset, and a
5296 # released CLI JSON id cannot disappear unclassified. The release coverage
5397 # audit runs the same classifier over the cut range, so the two agree.
5498 - name : Check Changeset coverage
55- if : github.event_name == 'pull_request'
99+ if : github.event_name == 'pull_request' && steps.release-sync-scope.outputs.required != 'true'
56100 env :
57101 MERGE_SHA : ${{ github.sha }}
58102 run : |
0 commit comments