Skip to content

fix(release): bridge the release app secrets with a token fallback, read Windows eligibility from the API, and scope the app tokens - #108

Merged
Upd4ting merged 12 commits into
mainfrom
fix/wec9b4589-40-caller-secrets-visibility
Nov 21, 2026
Merged

Upd4ting merged 12 commits into
mainfrom
fix/wec9b4589-40-caller-secrets-visibility

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Wec9b4589-40.

Why

Goal: fix the defects the verification of main at 0b40536 found before v2 moves, and close the hardening gaps in the same files.

  • The frozen release caller forwarded only RELEASE_GITHUB_TOKEN. Since feat(release): push releases and next-sync merges with the antelopejs-release app token #105 a stable or repin run exits 1 without RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY, and caller.test.ts passed only because both secrets are optional. README and AGENTS.md disagreed on whether callers must change.
  • ci-node.yml decided the Windows legs on github.event.repository.visibility, which GitHub does not document for the schedule payload, so a public repository could lose its nightly Windows legs.
  • Moving v2 deadlocked. v2 (ebac4e8) does not declare the app secrets, so a caller re-synced with tooling-configs#441 hits startup_failure (tooling-configs' Release run 44826303980). Main exits 1 without them, so once v2 moves every caller not yet re-synced fails its stable or repin release.
  • Each create-github-app-token call minted a token with every permission of the installation, and dirname took paths without --.

What

  • Transition fallback. release-npm.yml, both wrappers and next-sync.yml declare RELEASE_GITHUB_TOKEN, RELEASE_APP_ID and RELEASE_APP_PRIVATE_KEY as optional, and the wrappers forward all three. A stable, repin or next-sync run mints the app token when both app secrets are set. Otherwise it writes with RELEASE_GITHUB_TOKEN and logs a warning, and it fails only when neither is set. Sequence: merge this, move v2, re-sync the callers, revoke the token, then remove the fallback.
  • frozen-caller.yml, the starter workflow and the README example are now byte-identical to the release.yml tooling-configs#441 generated at ef8abf5: pull_request preview trigger, and both app secrets forwarded. caller.test.ts now requires the caller to forward every secret the entry declares, so a caller with only RELEASE_GITHUB_TOKEN fails.
  • README and AGENTS.md now say the same thing: callers forward the two app secrets as antelopejs-sync writes them, an older caller keeps working through the fallback, and the fallback goes away once every caller is re-synced and the token is revoked.
  • A Windows eligibility job runs only when Windows legs could run (same event and input conditions as before), reads the visibility with one gh api repos/$GITHUB_REPOSITORY --jq .visibility call on the job's GITHUB_TOKEN, and the node matrix adds windows-latest only when it returns public. A failed gate fails the run through checks instead of silently dropping Windows.
  • Release app tokens ask only what their job uses: release-npm.yml contents: write and pull-requests: read (release notes run gh pr list), next-sync.yml and module-locks-renovate.yml contents: write, module-locks-refresh.yml contents: write and pull-requests: write.
  • module-locks-refresh.yml checks the refresh patch in a scratch index before the release app token pushes it. It fails when the patch touches .github/ or .gitmodules, adds a symlink or a submodule, or holds a path git apply refuses (.git, outside the checkout). The refresh keeps its documented scope: it still commits the range moves in package.json and antelope.config.ts, pnpm-lock.yaml and the output of the caller's commands. The task's Done means first asked to limit the patch to antelope-lock/ paths as the renovate job does. That was wrong for this job, which the orchestrator confirmed: the renovate job copies only locks because Renovate already wrote package.json, while the refresh is built to commit more.
  • module-locks-renovate.yml runs dirname -- in both its calls, and the README's multi-package caller example forwards the app secrets and uses the generator's if.
flowchart LR
  R[stable / repin / next-sync run] --> C{RELEASE_APP_ID and<br/>RELEASE_APP_PRIVATE_KEY set?}
  C -->|yes| A[mint the app token, scoped permissions]
  C -->|no| T{RELEASE_GITHUB_TOKEN set?}
  T -->|yes| P[write with RELEASE_GITHUB_TOKEN, warning]
  T -->|no| X[fail]
Loading
flowchart LR
  E[schedule / merge_group / workflow_dispatch<br/>with windows inputs] --> G[Windows eligibility<br/>gh api repos/REPO .visibility]
  G -->|public| W[node matrix: ubuntu + windows]
  G -->|private / internal| U[node matrix: ubuntu]
  G -->|API call fails| F[checks fails]
  O[other events or windows: false] -->|gate skipped| U
Loading

Related issue

Wec9b4589-40, from the verification of AntelopeJS/.github at 0b40536 (ANT-2010 / #105 and Wec9b4589-35 / #107).

Verification

The caller test, before the caller fix (commit ca0b51f):

✖ failing tests:

test at scripts/release-train/caller.test.ts:89:5
✖ calls release-npm-public.yml with inputs, secrets and permissions it accepts (1.130667ms)
  AssertionError [ERR_ASSERTION]: the caller forwards every secret release-npm-public.yml declares
  + actual - expected
  
    [
  -   'RELEASE_APP_ID',
  -   'RELEASE_APP_PRIVATE_KEY',
      'RELEASE_GITHUB_TOKEN'
    ]
  
    generatedMessage: false,

After: ℹ pass 10, ℹ fail 0 for caller.test.ts.

The fallback tests (app secrets only, token only, neither, for stable, repin and next-sync), run against the workflows of 86d2833:

ℹ fail 7
ℹ pass 133
✖ RELEASE_GITHUB_TOKEN only stands in for the release app token, and each workflow that writes to the repository mints one (0.831578ms)
✖ Validate release credentials asks the private registry's token and refuses another registry (9.876886ms)
✖ a repin run writes with the app token when both app secrets are set, else with RELEASE_GITHUB_TOKEN, and fails with neither (2.290788ms)
✖ a stable run writes with the app token when both app secrets are set, else with RELEASE_GITHUB_TOKEN, and fails with neither (2.802552ms)
✖ failing tests:
✖ next-sync.yml (0.640838ms)
✖ pushes with the app token when both app secrets are set, else with RELEASE_GITHUB_TOKEN, and fails with neither (0.561568ms)
✖ release-npm-private.yml forwards every input but integration-branch and every secret to release-npm.yml, and names its registry (0.439799ms)
✖ release-npm-public.yml forwards every input but integration-branch and every secret to release-npm.yml, and names its registry (1.105824ms)
✖ release-npm.yml (6570.909391ms)
✖ the frozen caller (64.627382ms)

After: ℹ pass 140, ℹ fail 0.

The token permission test, before the workflow change (commit e0c02aa):

✖ each release app token asks only the permissions its job uses (1.06401ms)
ℹ pass 10
ℹ fail 1
✖ failing tests:
✖ each release app token asks only the permissions its job uses (1.06401ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
  + actual - expected
  + []
  - [
  -   'permission-contents: write',
  -   'permission-pull-requests: read'
  - ]

Windows legs on a schedule payload that names no repository, evaluating the os expression of main and of this branch. The payload without repository is inferred from GitHub's payload docs, not captured from a run:

before, public repository, schedule payload: ["ubuntu-latest"]
after, public repository, schedule payload: gate ran=true, ["ubuntu-latest","windows-latest"]
after, private repository, schedule payload: gate ran=true, ["ubuntu-latest"]

Checks on the final commit, Node.js 24:

$ tsc -p scripts/release-train/tsconfig.json
exit 0
$ tsc -p scripts/module-locks/tsconfig.json
exit 0
$ node --test scripts/release-train/*.test.ts
ℹ tests 140
ℹ pass 140
ℹ fail 0
$ node --test scripts/module-locks/*.test.ts
ℹ tests 31
ℹ pass 31
ℹ fail 0
$ renovate-config-validator --strict --no-global renovate.json5
 INFO: Config validated successfully against 1 file(s)
exit 0
$ actionlint .github/workflows/*.yml
1.7.12
exit 0

The refresh patch tests, run against main's module-locks-refresh.yml:

    ✖ passes a refresh that moves locks, ranges and other files, and leaves the checkout alone (40.093717ms)
    ✖ refuses a .gitmodules (35.24157ms)
    ✖ refuses a path outside the checkout (28.219657ms)
    ✖ refuses a path under .git (28.743496ms)
    ✖ refuses a submodule (43.782533ms)
    ✖ refuses a symlink (36.132416ms)
    ✖ refuses a workflow (35.89796ms)
  AssertionError [ERR_ASSERTION]: no step Check the refresh patch
  ✖ checks the refresh patch before it pushes (249.064929ms)
ℹ fail 7
ℹ pass 0

One patch that adds .github/workflows/x.yml and a symlink, applied by main's push step and checked by the new step:

git apply --index (main's push step): exit 0
100644 0000000 b83836e A	.github/workflows/x.yml
120000 0000000 3594e94 A	link
::error::The refresh patch changes .github/workflows/x.yml, which is under .github or declares submodules. Nothing was pushed.
::error::The refresh patch changes link, which is a symlink. Nothing was pushed.
Check the refresh patch (this branch): exit 1

Checklist

  • The pull request title follows Conventional Commits.
  • I added or updated tests when behavior changed.
  • I updated documentation when users or contributors are affected.
  • I documented breaking changes and migration steps. No caller breaks when v2 moves: an older caller releases through the RELEASE_GITHUB_TOKEN fallback until it is re-synced.
  • I did not include credentials or unrelated changes.

Skills

no skill change

Follow-ups

  • proposed AntelopeJS/.github: next-sync (and a module-locks refresh rebased on a newer main) pushes .github/workflows/* changes with the antelopejs-release app token, which GitHub refuses unless the token holds workflows: write; the installation grants only contents and pull_requests, so this predates this pull request and is unverified on a real run. Done means: the app installation grants workflows: write, next-sync asks permission-workflows: write, and a sync that brings a workflow change from main into develop pushes.

@Upd4ting Upd4ting changed the title fix(release): forward the app secrets in the frozen caller and read Windows eligibility from the API fix(release): bridge the release app secrets with a token fallback, read Windows eligibility from the API, and scope the app tokens Nov 21, 2026
@Upd4ting
Upd4ting marked this pull request as ready for review November 21, 2026 00:31
@Upd4ting
Upd4ting added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit 236f1af Nov 21, 2026
4 checks passed
@Upd4ting
Upd4ting deleted the fix/wec9b4589-40-caller-secrets-visibility branch November 21, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant