Repository navigation
chore: move release confirmations to a separate notification job - #10320
Conversation
|
Branch Preview URL (stable): Deployment URL (unique): |
commit: |
There was a problem hiding this comment.
Edit (re-verified): I checked every statement again. I removed the 404/403 note, because the old plugin also failed on a missing issue number, so it is not a regression. I also corrected the release sizes and made the suggestions more exact. The main finding did not change.
Thanks for this — moving the confirmations out of the publish path is the right fix, and most of it checks out. One thing I think should be fixed before merging, and two smaller notes.
Should fix: the job uses up the GITHUB_TOKEN request budget on a larger release
The job now runs on github.token. dnbexperience is not an Enterprise Cloud org (the org plan is free), so the documented limit is 1,000 requests per hour per repository, and other workflows in the repo share it. The old plugin ran on GH_TOKEN (5,000/h) and used @semantic-release/github/lib/octokit.js with @octokit/plugin-throttling, which waits when a rate limit is hit.
I ran the notify-release script against the real API for two real releases. I used a harness that runs the inline script from release.yml the way actions/github-script@v9 runs it (new AsyncFunction(...)). GET requests went to GitHub. Every POST was intercepted, so nothing was written. The commit lists are git log <prev-tag>..<tag>^, which is the range semantic-release used.
| Release | Commits | Targets | GETs | POSTs | Total |
|---|---|---|---|---|---|
| 11.16.1 (fresh) | 105 | 110 | 215 | 220 | 435 |
| 11.16.0 (already notified) | 292 | 352 | 644 | 352 (labels only) | 996 |
| 11.16.0 (fresh, derived) | 292 | 352 | 644 | 704 | ~1,348 |
- A fresh run of a release this size goes over the hourly limit. It would also make 352 comment POSTs plus 352 label POSTs in under 20 minutes. If label requests count as content-creating, that also passes the secondary limit of 500 content-creating requests per hour.
- A re-run does not recover. A re-run repeats every commit lookup and every label POST, even for targets that are already done. A re-run of the already-notified 11.16.0 costs 996 requests and has nothing left to post.
- Nothing waits for the limit to reset.
github-scriptonly has@octokit/plugin-retry. Withretries: 3, a 403 is not retried (it is in the defaultretry-exempt-status-codes), and a 429 is retried after 1, 4 and 9 seconds. The job then ends half-done.
For scale: the 16 releases from 11.8.0 to 11.15.2 had 5–136 commits, so most releases stay under the limit. A release like 11.16.0 does not, and those releases have the most PRs to confirm.
Possible directions:
- For the fresh case, the job needs a bigger budget or has to wait. For example, run it with
GH_TOKENas before, or add throttling that waits for the reset, like the old plugin did. - To make re-runs cheap, skip the label POST when the label is already there.
GET /commits/{sha}/pullsalready returnslabelsfor each PR (I checked: the 11.16.0 release commit returns#9729withreleased), so PRs need no extra request.
What I verified and found correct
- Root cause: the 11.16.1 log fails at
@semantic-release/github/lib/success.js:81, which is theassociatedPullRequestsGraphQL chunk. In 12.0.8,successCommentCondition: falseskips that whole branch (success.js:68). The fail-issue closing still runs, as before. Thesuccessstep usessettleAll: true, so the new plugin still runs when the GitHub plugin'ssuccessfails. Channel promotions getcommits(semantic-release/index.js:151). - Parity with the old plugin, on 11.16.0: all 352 targets that the new discovery finds already have the old
:tada: … in version 11.16.0comment, and the legacy check found every one (0 duplicate comments). All 61 issues that got the old "resolved in version 11.16.0" comment (found with search) are in the set. Two PR numbers from the commit titles are not in the set: #9720 and #10024. The old plugin skipped them too, because GitHub associates those commits only with the release PR #9729. So this is not a regression. - Real execution path: the inline
github-scriptcode importsnotifyRelease.tsand runs without problems on Node 24.20 locally (it uses type stripping and only shows theMODULE_TYPELESS_PACKAGE_JSONwarning). I could not run it on the runner's own Node 24. The relative plugin path../scripts/postbuild/releaseNotification.tsloads through semantic-release's ownloadPluginfrombuild/as cwd. - Tests: 16/16 pass. I changed the code on purpose in 8 ways to check the tests. They caught 7: the PR-commit check, the
merged_atcheck, the base-repo check,O_NOFOLLOW, the issue slug filter, the label value, and the PR-body parsing. Only removingftruncateSyncpassed, and that is harmless because the file only grows. I skipped the semantic-release entry-point test in these runs, because it timed out on my busy machine. It passes in a normal run and in CI. - CI is green on
94f132d. The CodeQL race warning was on the first commit. Its instance is nowfixed, and the CodeQL check reports no new alerts.
Non-blocking
- 11.16.1 still has no confirmations. I checked all 110 targets (104 PRs, 6 issues) again just now. None has a comment about 11.16.1 or the
releasedlabel, and this PR does not back-fill them. If you want them, a one-off run after merge is needed. - FYI: the comments will now come from
github-actions[bot]instead of theGH_TOKENaccount. The legacy check does not depend on the author, so that is fine.
langz
left a comment
There was a problem hiding this comment.
Approved. I reviewed 94f132d again from the start. The head is the same as in my review from 29 October, so this review gives the final verdict and adds new measurements. I found no critical must-fix issues.
Why I approve
- It removes the failure that stopped 11.16.1. The failed job crashed at
@semantic-release/github/lib/success.js:81(the GraphQLassociatedPullRequestslookup) after npm had published. The re-run published nothing, so 11.16.1 still has no SBOM: its GitHub release has only the.tgz, while 11.16.0 also hassbom.cdx.jsonandvulnerability-report.json. In 12.0.8,successCommentCondition: falseskips that whole lookup (success.js:68). No jobneedsthe new job, so it cannot block the SBOM, attestation or Portal jobs. - It also takes a timeout risk out of the publish job. 11.16.0 still posted its confirmations from inside that job: the
successstep took 18.5 minutes, and the job used 27 of its 30 minutes. - It finds the same targets as the old plugin. I replayed the inline script from
release.ymlagainst the real API. Reads went to GitHub, and every write was intercepted. The commit list came from semantic-release's owngetCommits. For 11.16.0, it found exactly the 352 numbers that the old plugin commented on (290 PRs from the commit lookup, 62 from closing keywords). It recognised all 352 old comments, so it would post 0 duplicates. For 11.16.1, it found 110 targets with 0 errors. - The tests guard the important parts. 16/16 pass, also on the PR merged with today's
main(26 commits ahead;release.ymlmerges cleanly with #9918 and #10312). The end-to-end test takes about 1.2 s in CI, so it adds no real risk to the release build job, which also runs it. I broke two things on purpose: I ignored the old plugin's comments, and I removed the channel from the marker. Each time, the matching test failed.
Should fix, not blocking: the GITHUB_TOKEN request budget
The finding from my earlier review stands. I measured it again and got the same numbers:
| Release | Commits | Targets | Requests, first run | Requests, re-run when all are done |
|---|---|---|---|---|
| 11.16.1 | 105 | 110 | 435 | – |
| 11.16.0 | 292 | 352 | about 1,348 | 996 |
The job token has 1,000 requests per hour for the whole repository (the org plan is free). The pinned github-script adds @octokit/plugin-retry but no throttling. It does not retry a 403, and it does not wait for x-ratelimit-reset. These new facts change how much this matters:
- It is rare. Only 1 of the 35 stable releases from v11.0.1 to v11.16.1 goes over the limit: 11.16.0, with 292 commits. The next largest, 11.15.2 (136 commits), needs about 600 requests. The limit is at about 220–240 commits.
- On such a release, the job does less than the old plugin did. The old plugin confirmed all 352 targets of 11.16.0. This job would stop at about target 236 (1,000 − 292 lookups, then 3 requests for each target), unless the hourly window resets during the run. A re-run then spends about 764 requests on the lookups and on targets that are already done, before it gets to the first missing one.
- Correction to my earlier review: I found no sign that the secondary limit is a problem. With the personal token, the old plugin made 704 writes for 11.16.0 in 17.5 minutes, and no gap between two writes was longer than 5 s.
The smallest fix: for a PR that already has the label, skip the comment check and the label request. GET /commits/{sha}/pulls already returns the labels, and all 290 PR targets of 11.16.0 have released. A re-run of 11.16.0 then costs about 416 requests instead of 996, so one re-run after the reset finishes a large release. To finish it in one run, give the job a larger budget (GH_TOKEN, or the release app token from #10343 with 5,000 per hour). Or let it wait for x-ratelimit-reset like the old plugin did. Then timeout-minutes: 30 must go up.
Nit
- When the job fails, the log does not say why.
github-scriptprints the final error with Node's default depth, so the errors for each target show only as[errors]: [Array]. The request log still prints the method, path and status of each failed request (for examplePOST /repos/dnbexperience/eufemia/issues/123/labels - 403). But it does not print GitHub's message, so you cannot see if a 403 comes from the rate limit. Onecore.error()for each collected error, with its cause, would show it.
The two non-blocking notes from my earlier review still apply. I checked again today: none of the 110 targets of 11.16.1 has a confirmation comment for that version. If you want them, a one-off run after the merge is still necessary.
langz
left a comment
There was a problem hiding this comment.
Post-merge review of 206841c75e. I found nothing critical. I would have approved this.
The PR was merged at 15:37, and my last approval was at 94f132d221. git range-diff shows the first two commits as = on the same base (dd8a50f2e6). So the only unreviewed change is 206841c ("Keep release notifications within the API request budget"), and this review covers that commit.
What 206841c changes
- The existing release label is not applied again.
notifyReleasereadspr.labelsfrom thecommits/{sha}/pullsresponse it already fetches, and skips thePOST …/labelscall (and its 1 s pause) when the PR already has the label for this channel. Issues still always get the label, and comment dedup is unchanged: it checks theeufemia-release:<tag>:<channel>marker and the old semantic-release text, not the author. The two new tests cover both the skip and a different channel (releasedpresent →released on @betais still added). - Errors are logged before the job fails.
describeErrorwalkscauseanderrors, so anAggregateErrornow shows each failed issue or PR in the job log. It follows a cycle incauseforever, but Octokit errors don't have one. - The token changed. The step now uses
github-token: ${{ secrets.GH_TOKEN }}instead of the job'sGITHUB_TOKEN, so the calls count against the PAT's own rate limit instead of the repository's Actions token limit. Comments now come from the same account semantic-release used for them before #10320, so earlier runs stay deduplicated.
Not blocking
- With the PAT, the job's
permissions:block (pull-requests: write,issues: write) no longer limits these API calls. The PAT's own scopes do. It is only available in that one step, but that step also runsissue-parserand the other repository code thatnotifyRelease.tsimports. That is the same level of trust semantic-release had withGH_TOKENbefore this PR. Still, the header comment ofrelease.yml("GitHub write permissions exist only in the release job") is now only half true. A short comment on the step, saying why it needs the PAT, would keep that clear. - Events created with a PAT start other workflows.
GITHUB_TOKENevents do not. So the comments and labels can startissue_commentandlabeledworkflows on every included PR again, as they did with semantic-release before #10320.
CI on 206841c75e: 23 checks passed and 16 were skipped.
notify-release (#10320) downloaded `release-notification` by name. The publish job now records the upload's artifact ID, and notify-release downloads it by that ID, like the prepared package and the SBOM.
… ID, run smoke tests in parallel (#10404) The release workflow trusts two things that other jobs can change, and a release that fails after publishing cannot be finished with a re-run. This PR fixes both, and makes the smoke, SBOM and attestation steps faster. ## Continuing a failed release v11.16.1 published to npm, and then semantic-release's `success` step failed (`TypeError: Cannot destructure property 'repository'`). That skipped the portal deploy, the SBOM and the attestation. **Re-run failed jobs** deployed the portal, but skipped the SBOM and the attestation again: the re-run of the publish job published nothing new, so `Capture released version` read the placeholder `0.0.0-development` from `build/package.json`. v11.16.1 has no SBOM, no vulnerability report and no attestation (its GitHub release holds only the `.tgz`, and the attestations API returns "Not Found" for its digest). Since September 2025, 9 of 89 runs on `release` failed and 1 was cancelled, and several releases were retried with new release PRs. - **Capture released version** runs also when the Release step failed. It takes the version semantic-release stamped or, on a re-run, the version tag on the release commit, whose parent is the run's commit. It sets `released` only once `npm view` lists that version, and waits up to 140 s for the registry. If npm does not list it, it fails with an error that points to the recovery steps in the deploy docs, because that is the case where a tag exists without a published version. - **Deploy portal to GitHub Pages**, **Generate release SBOM** and **Attest and publish release SBOM** run when npm has the version, also when the publish job failed later. In the v11.16.1 case, the release would have finished in the first attempt. - **Attest and publish release SBOM** takes the tarball from npm (`npm pack @dnb/eufemia@<version>`, which checks it against the registry's integrity hash). For v11.15.2 and v11.16.1 that file had the same SHA-1 as npm's `dist.shasum`. It no longer needs an artifact from the publish job, so it can attest after the run's artifacts have expired, and no job in the run can replace its subject. An empty version is refused, because `npm pack @dnb/eufemia@` would fetch the latest release. - The prepared package and the Pages site are kept for 7 days instead of 1, so **Re-run failed jobs** works for a week. After that, **Re-run all jobs** builds them again (GitHub allows re-runs for 30 days). What to do when a step fails, after this PR: | Failure | What runs | What to do | | --- | --- | --- | | Build, or publish before npm has the version | Nothing after it | Re-run failed jobs | | Publish job fails after npm has the version | Deploy, SBOM and attestation still run | Nothing for those. A missing GitHub release must be created for the tag by hand (a re-run does not create it), then re-run the attestation job | | Tag pushed, npm publish failed | Nothing after it; the capture step reports it | Maintainer task, as before: remove the tag, then re-run (deploy docs, "Releases queue") | | Deploy, SBOM or attestation fails | The other jobs still run | Re-run failed jobs (a re-run of the deploy also re-runs the SBOM and attestation after it) | Two things are not covered. v11.16.1 itself stays without an SBOM: a re-run of its run uses the old workflow file. A version older than GitHub's 30-day re-run limit needs a manual run, which this PR does not add. ## Security **The shared dependency cache.** The build job restores the `node_modules` cache that every workflow shares. On an exact hit, `.github/actions/setup` skips `yarn install`, so nothing checks the restored tree against `yarn.lock`. A run on `release` can restore caches saved on `main`. A job on `main` that misses the cache installs, runs its steps, and saves `node_modules` at the end of the job, so a compromised dependency in any of those steps can change the tree before it is saved. The package, the portal and the Algolia index are built from that tree. A poisoned Actions cache is how the Ultralytics release was compromised in December 2024. **Artifact names.** Any job in a run can replace an artifact of the same name: `overwrite: true` deletes it, and the replacement gets a new ID (upload-artifact README: "this will give the Artifact a new ID, the previous one will no longer exist"). The trusted jobs download by name, and code we do not control runs before them: - The consumer smoke tests run `npm ci`, with lifecycle scripts, after the build job uploads the prepared package. - The portal link check restores the shared cache and loads `parse5`. In the v11.16.0 run it finished at 10:06, and the Pages deploy started at 10:44. It also runs at the same time as the SBOM and attestation jobs. - The SBOM job runs the CycloneDX generator through `yarn dlx`. It runs before the attestation job, and in the v11.16.0 run it also ran before the deploy (generator 10:42:00–10:42:06, deploy started 10:44:28). Changes: - **Build and validate release** installs with `yarn install --immutable` instead of restoring the shared cache. That install took 34–37 s in nine Dependabot runs that had no cache at all; restoring and saving the cache took 12–22 s on the last 12 releases, so this costs about 15–25 s. The job records the artifact ID of the prepared package. - **Publish release** downloads the prepared package by that ID. A replaced package is not found, so the release stops before anything is published. An empty ID would make `download-artifact` fetch every artifact of the run, so the input falls back to `missing`, which fails the download (`Invalid artifact ID: 'missing'`). - **Generate release SBOM** sets up Node.js only, and records the ID of its upload. The generator reads each package manifest through Yarn's fetcher, with its integrity check off (`skipIntegrityCheck: true`), and `yarn npm audit` reads the lockfile, so neither uses `node_modules`. On a cache miss, the shared setup action restores the shared Yarn download cache, which the generator would then read, unchecked, into the SBOM that the next job signs. - **Attest and publish release SBOM** downloads the SBOM by the ID the SBOM job recorded, and takes the tarball from npm (above). Its condition is explicit: the default `success()` also counts jobs further up the chain, so after a skipped or failed portal deploy it would have been skipped, on every branch without a deploy (actions/runner#2205). The first commit of this PR had that bug. - **Notify released PRs and issues**, added on main by #10320, downloads the notification details by the ID the publish job recorded, like the prepared package. - **Deploy portal to GitHub Pages** deploys the Pages artifact the build job uploaded. The build names it per run attempt (`github-pages-<attempt>`) and records its ID, and the deploy job checks that ID before `deploy-pages` runs. The per-attempt name also lets the deploy succeed after **Re-run failed jobs** on a failed build: a re-run keeps the earlier attempt's artifacts, and `deploy-pages` refuses a name that two artifacts share (actions/deploy-pages#338). - **Validate portal links** and **Generate release SBOM** start after **Deploy portal to GitHub Pages**, because `actions/deploy-pages` can only find its artifact by name (`artifact_name`). `!cancelled()` keeps both when the publish or the deploy fails, and keeps the SBOM on the branches that do not deploy the portal. The link check still restores the shared cache, because it needs `parse5`, but no later job reads an artifact by name any more. ## Speed - **The two consumer smoke tests run in parallel**, in `release.yml` and in `consumer-smoke.yml`. Most of each test is `npm install` of the 28,000-file tarball. `run-smoke.mjs` now takes several fixtures and runs each in its own process, with every output line prefixed by its fixture; after all of them finish, it fails if any failed. On this PR the step took 48–66 s in three runs, against 39 + 51 s for the two steps in turn on the first commit (median 34 + 46 s over the 84 runs on 29 October). The two installs slow each other down (44–46 s each, against 25–27 s alone in the v11.16.1 release), so the gain on this PR was 24–42 s, not the whole of the shorter test. - **`consumer-smoke.yml` drops its npm cache.** A pull request cannot restore another pull request's cache, so every pull request saved its own copy: on 31 October, 64 copies under one key held 8.6 GiB of the repository's 10 GiB cache, which was full. #9269 measured a hit no faster than a miss (1.32 against 1.20 minutes), and named deleting the step as the alternative. - **Generate release SBOM** no longer restores the shared cache: 13–21 s per release, at the end of the run, which the attestation job waits for. - **Publish release** no longer packs `build/` a second time for the attestation (19–27 s on the last 9 releases); the attestation job downloads the tarball from npm instead. Measured, and left for separate PRs: - Building the portal in its own job would take about 80 s off the build job (portal build 52–75 s, plus its uploads). It needs its own prebuild, and it either lets a portal failure no longer block the npm release, or gives the publish job a condition that #10320's notification job inherits through the chain. - `validate:package` and the smoke pack step both pack `build/` (20–27 s each). Packing once saves one of them, but it changes the package gate. ## How it was checked - The new **Capture released version** script, taken from the workflow file, in a synthetic repository with the same shape as a release (feature commits, `chore(release)` commits, version tags), from a shallow checkout without tags, as `actions/checkout` leaves it, and with a stand-in `npm`: first attempt published → set; failed before npm had it → not set, error; re-run after publishing → set from the tag; re-run with nothing released → not set; a commit that a later release included → not set; tag pushed but npm missing → not set, error; npm lists it on the third try → set. A control without the script's own `git fetch` did not find the tag, so the test covers that fetch. On the real history, the tag lookup gives 11.16.1 for the v11.16.1 run commit and 11.16.0 for v11.16.0's, and nothing for its neighbour commit or for the `main` tip. - The new tarball step, taken from the workflow file, against the real registry: 11.16.1 → npm's exact file; a missing version → five `ETARGET` failures, then exit 1; an empty version → exit 1 before npm runs. - `download-artifact` v8.0.1 source at the pinned SHA: by ID, it lists the run's artifacts, keeps the newest per name, and matches the ID. A single artifact is extracted straight into `path`, as by name (`artifacts.length === 1`). Downloads by name and by ID send the same `ListArtifacts` request, and the v11.16.1 re-run (build job reused from attempt 1) found attempt 1's package by name, so a re-run finds it by ID too. - The SBOM generator (`@cyclonedx/yarn-plugin-cyclonedx` 3.3.3) on the same `yarn.lock`, once with no `node_modules`, install state or Yarn cache, and once in a full install: the SBOMs were identical apart from the serial number and the timestamp (39 components, all with licenses). `yarn npm audit` for all environments, as a control: the same 7 advisories in both. - semantic-release's tarball: in the v11.16.1 log, the npm plugin packs after writing the version, then the git plugin only commits `CHANGELOG.md`, then `npm publish` runs. On four releases from before the SBOM attestation (v10.104.2, v11.7.0, v11.8.2, v11.8.3), the tarball attached to the GitHub release had the same SHA-1 as npm's, so the attestation job's upload replaces it with the same bytes. - `run-smoke.mjs` locally with the published v11.16.1 tarball: Vite in parallel with a test fixture that fails at `npm ci`. The broken one failed after 12 s, Vite still ran to the end and passed, the summary listed both, and the exit code was 1. Missing or wrong arguments exit 1 with the usage text. - actionlint 1.7.12 with shellcheck: no findings. zizmor 1.31.1: 10 fewer findings in `release.yml` and `consumer-smoke.yml` (all 4 `template-injection`, 4 `secrets-outside-env`, 2 `self-repository`), none added. Prettier 3.8.1: clean. - Merging with #10343 conflicts in the deploy docs: both change the sentence about what a re-run can finish, and this PR's version describes the new behaviour. Rebased on #10320, which conflicted in the publish job's `outputs` (kept both `released` and `notifications`). #10320's notification upload and `notify-release` job still need a successful publish job, so after a failure later in the Release step they are skipped. - The full release path runs only on the next release.
|
🎉 This PR is included in version 11.17.0 🎉 The release is available on GitHub. |
The v11.16.1 release failed after publishing because the release-confirmation lookup timed out, which also skipped the SBOM, attestation and Portal deployment (release run).
Keep the version confirmation and
releasedlabels on included PRs and resolved issues, but send them from a separate job using sequential REST requests. The job uses semantic-release's exact commit list and can be retried without publishing again or duplicating comments. Notification failures no longer block the remaining release jobs.Replaces #10314 and #10315 without patching the dependency.