Repository navigation
ci: fix runtime publish (tag/Node), commit regenerated runtime back, auto-commit sponsor image - #5647
Conversation
The OIDC migration (#5646) authenticates correctly but `npm publish` fails on npm >= 11 with 'You must specify a tag using --tag when publishing a prerelease version' — the old JS-DevTools action defaulted to `latest` implicitly. v3 intentionally ships alpha.N as the default dist-tag (the templates pin "@wailsio/runtime": "latest"), so publish with --tag latest. Also bump the CI Node from the deprecated 20 to 22 (LTS).
WalkthroughTwo CI workflows receive modernization updates: the sponsor-image generation workflow now uses Node.js 22, explicit repository token checkout, and direct commit-to-branch instead of pull-request creation. The npm publish workflow also upgrades to Node.js 22, adds artifact verification to catch missing generated files, improves git staging with ChangesSponsor Image Generation Workflow
npm Publish Workflow Updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/publish-npm.yml (1)
81-84: 🧹 Nitpick | 🔵 Trivial | 💤 Low valueConsider pinning the action to a commit hash for supply chain security.
Static analysis flags this action as unpinned. While GitHub's official actions are generally trusted, pinning to a hash would align with the approach used for
step-security/changed-fileselsewhere in this workflow and mitigate potential tag-hijacking risks.You can find the commit hash for
v4from the releases page.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/publish-npm.yml around lines 81 - 84, The setup-node action in the workflow file is currently referenced using a version tag v4, which is a mutable reference vulnerable to tag hijacking. Replace the version tag with a specific commit hash by changing the uses field from actions/setup-node@v4 to actions/setup-node@ followed by the full commit hash for v4 (obtainable from the GitHub releases page for the actions/setup-node repository). This pins the action to an immutable commit reference, aligning with security best practices already applied to other actions in the workflow.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/publish-npm.yml:
- Around line 81-84: The setup-node action in the workflow file is currently
referenced using a version tag v4, which is a mutable reference vulnerable to
tag hijacking. Replace the version tag with a specific commit hash by changing
the uses field from actions/setup-node@v4 to actions/setup-node@ followed by the
full commit hash for v4 (obtainable from the GitHub releases page for the
actions/setup-node repository). This pins the action to an immutable commit
reference, aligning with security best practices already applied to other
actions in the workflow.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8175124f-b83b-4e80-9e54-3dfe58563163
📒 Files selected for processing (1)
.github/workflows/publish-npm.yml
…aster Harden the publish flow per the existing regenerate-before-publish design: - add a Verify step that fails the job if (re)generation didn't produce the expected outputs (bundled runtime + npm dist/), catching silent build failures before anything is published or committed. - make the commit-back explicit: 'git add -A' sweeps every regenerated tracked file (bundled runtime in internal/assetserver/bundledassets, generated pkg/events/events.go, TypeDoc output) back to master alongside the version bump; log 'git status' so the committed set is visible. dist/ is gitignored and is rebuilt fresh by prepack at publish time.
Push the regenerated website/static/img/sponsors.svg straight to master (no-op when unchanged) using the bypass-capable WAILS_REPO_TOKEN, matching publish-npm.yml, rather than opening a daily 'update sponsors' PR. Also modernise the actions (checkout v3->v4, setup-node v2->v4, Node 20->22).
latest + bump CI Node to 22There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/generate-sponsor-image.yml:
- Line 16: The workflow uses mutable version tags (`@v4`) for the actions/checkout
and actions/setup-node actions, which creates a security vulnerability. Replace
the mutable `@v4` tags with immutable commit SHA references: update
actions/checkout@v4 to actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
and update actions/setup-node to
actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020. This pins the
workflow to specific commit hashes rather than allowing the action version to
change unexpectedly.
- Around line 13-20: The high-privilege WAILS_REPO_TOKEN is being passed to the
actions/checkout@v4 step where it persists as a credential for the entire
workflow, increasing exposure risk. In the checkout step, add
persist-credentials: false to disable credential persistence and remove the
token override to use the default read-only github.token instead. Move the
WAILS_REPO_TOKEN to only the git push operation in a subsequent step where it is
actually needed for pushing to the protected branch. Before using the bypass
token in the push operation, add a validation check to ensure WAILS_REPO_TOKEN
is available, and only pass it to the specific git command that requires
elevated permissions rather than making it available globally throughout the
workflow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 442a9977-b102-4985-85e8-3dc00508b9b4
📒 Files selected for processing (2)
.github/workflows/generate-sponsor-image.yml.github/workflows/publish-npm.yml
Follow-up to #5646 (npm Trusted Publishing / OIDC). Three CI fixes:
1. Publish prerelease as
latest+ Node 22The OIDC migration authenticates correctly, but the first run failed at
npm publish:npm ≥ 11 won't implicitly tag a prerelease (
-alpha.N) aslatest; the oldJS-DevTools/npm-publishaction did. v3 intentionally shipsalpha.Nas the default dist-tag (templates pin"@wailsio/runtime": "latest"), so publish with--tag latest. Also bumps CI Node20→22(clears the runner deprecation warning).2. Verify generated artifacts + commit the regenerated runtime back
task runtime:buildregenerates tracked, non-npm files — the bundled desktop runtime (internal/assetserver/bundledassets/runtime.js+.debug.js) andpkg/events/events.go— which must stay in sync with the published package.dist/), catching silent build failures before publish/commit.git add -A+ logsgit status, so every regenerated tracked file is committed back tomasteralongside the version bump (dist/is gitignored and rebuilt byprepackat publish).3. Sponsor image: auto-commit instead of PR
generate-sponsor-image.ymlopened a dailyupdate sponsorsPR. It now pushessponsors.svgdirectly tomaster(no-op when unchanged) via the bypass-capableWAILS_REPO_TOKEN, same pattern aspublish-npm.yml. Actions modernised (checkout v3→v4, setup-node v2→v4, Node 20→22).Validated with
actionlint(clean).Summary by CodeRabbit