Repository navigation
A manual re-post of a release announcement works - #254
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b8581ee06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| }) | ||
|
|
||
| test('a manual re-post reads the release from RELEASE_FILE, which is the release itself and not an event around it', async () => { | ||
| const dir = mkdtempSync(join(tmpdir(), 'announce-')) |
There was a problem hiding this comment.
Import the helpers used by the new test
Running node --test tools/announce-release.test.mjs now fails immediately with ReferenceError: mkdtempSync is not defined, so the new test never exercises RELEASE_FILE. The required mkdtempSync, writeFileSync, tmpdir, join, and spawn bindings are declared only inside the preceding test and are not visible here; import them at module scope or within this test.
Useful? React with 👍 / 👎.
What this changes
A manual re-run of the Announce workflow (Actions, Announce, Run workflow, with a tag) failed with "The event carries no release". The workflow wrote the release to
event.jsonand setGITHUB_EVENT_PATHto it throughGITHUB_ENV, but a step cannot change that variable: the runner keeps its own event file, which for a manual run has noreleasein it. An automatic run on a real publish was fine, because that event does carry the release.release.jsonand setsRELEASE_FILEto it.tools/announce-release.mjsreadsRELEASE_FILEwhen it is set (the release itself), and falls back toGITHUB_EVENT_PATH(an event around it) as before.I hit the same thing building the beta announcer for the private beta repository (McCal-Codes/folio-beta,
.github/workflows/announce-beta.yml), where the first manual run said "Not a published release" and posted nothing, and fixed it there the same way.How I checked it
node --test tools/announce-release.test.mjs: 16 pass (15 before and a new one that runs the script withRELEASE_FILEset andGITHUB_EVENT_PATHpointing at nothing).DISCORD_WEBHOOK_URLSsecret, which is still unset on this repository (the only secret isFOLIO_SITE_TOKEN), so a real post is inert until it exists.Cheap way out: revert; automatic runs behave as before either way.