-
Notifications
You must be signed in to change notification settings - Fork 1
prevent creating a release when the pinned js sdk version is differen… #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
931208d
d9e029e
a0a50cf
1d410df
e2999ba
a214795
2c24236
8d5e6bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,13 @@ | ||||||||||||||||||||||||||||||||
| name: Auto Tag on Version Change | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
plus a job-level guard, e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For The sdk gate is no help here — it reads the pin from the same unreviewed branch, so a branch that bumps both files sails through. Concretely: open a branch, set A job-level guard keeps the manual retry path (dispatch on jobs:
tag:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'Worth deciding whether you want |
||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||
| paths: | ||||||||||||||||||||||||||||||||
| - 'Cargo.toml' | ||||||||||||||||||||||||||||||||
| - 'src/dev/sdk-js-version' | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding this path is the right fix for the retry, but it also widens the check-then-push race that Two runs can now be in flight for the same
That used to be a green no-op twice over: the pin push queued no run at all, and Nothing double-releases, so this is noise rather than danger — but it's the same class of noise concurrency:
group: auto-tag
cancel-in-progress: falseThat serialises the runs so the second one's |
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| tag: | ||||||||||||||||||||||||||||||||
|
|
@@ -16,7 +18,7 @@ jobs: | |||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Get version | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| id: get_version | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
|
|
@@ -26,10 +28,37 @@ jobs: | |||||||||||||||||||||||||||||||
| echo "Detected version: $VERSION" | ||||||||||||||||||||||||||||||||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Check if version is already tagged | ||||||||||||||||||||||||||||||||
| id: tagged | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| if git ls-remote --exit-code origin "refs/tags/${{ steps.get_version.outputs.version }}" > /dev/null; then | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
| echo "exists=true" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropping Gating on 1. 2. There's no Neither is dangerous — nothing double-releases — but each is a failure notification on a no-op, which is exactly the noise Distinguishing 2 from 128 fixes (1) and makes the intent explicit:
Suggested change
For (2), a top-level |
||||||||||||||||||||||||||||||||
| echo "exists=false" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Verify the pinned sdk-js matches the version play ships | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| if: steps.tagged.outputs.exists == 'false' | ||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.PLAY_READ_PAT }} | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Two things landed together across One hit, in the workflow itself. Nothing records that it must be a fine-grained PAT with Contents: read on The failure is worse than just undocumented, because both variants die before the
Either way every release is hard-blocked, on a step named "Verify the pinned sdk-js matches the version play ships" — which reads like play is ahead, not like the token lapsed. Restoring the pre-check is three lines and puts the secret's name and requirements in the one place someone will definitely be looking:
Suggested change
That doesn't cover the 401 case, and it isn't a substitute for writing the runbook down somewhere — but "somewhere" needn't be |
||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||
| pinned=$(tr -d '[:space:]' < src/dev/sdk-js-version) | ||||||||||||||||||||||||||||||||
| # play deploys prod on `release: published`, so its latest release is what's live | ||||||||||||||||||||||||||||||||
| tag=$(gh api repos/wvdsh/play/releases/latest --jq .tag_name) | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
franzwarning marked this conversation as resolved.
franzwarning marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||
| shipped=$(gh api -H "Accept: application/vnd.github.raw" \ | ||||||||||||||||||||||||||||||||
| "repos/wvdsh/play/contents/package-lock.json?ref=$tag" \ | ||||||||||||||||||||||||||||||||
| | jq -er '.packages["node_modules/@wvdsh/sdk-js"].version') | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
Comment on lines
+48
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a fail-closed gate keyed on three unverified assumptions about a repo this one can't see: that play has a |
||||||||||||||||||||||||||||||||
| echo "cli pins $pinned; play $tag ships $shipped" | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The remediation command in this message doesn't run as written — the script isn't executable. Mode
Only Cheapest fix that makes both this message and
Suggested change
(Separately, "then push the bump to retry the release" is still not true — see the trigger- |
||||||||||||||||||||||||||||||||
| if [ "$pinned" != "$shipped" ]; then | ||||||||||||||||||||||||||||||||
| echo "::error::wavedash dev would inject @wvdsh/sdk-js@$pinned but play $tag ships $shipped. Run scripts/bump-sdk-js.sh $shipped, verify a game boots with wavedash dev, then push the bump to retry the release." | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
franzwarning marked this conversation as resolved.
franzwarning marked this conversation as resolved.
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
franzwarning marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| - name: Create and Push Version Tag | ||||||||||||||||||||||||||||||||
| if: steps.tagged.outputs.exists == 'false' | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| git config user.name "github-actions[bot]" | ||||||||||||||||||||||||||||||||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||||||||||||||||||||||||||||||||
| git tag -a "${{ steps.get_version.outputs.version }}" -m "Release ${{ steps.get_version.outputs.version }}" || echo "Tag already exists" | ||||||||||||||||||||||||||||||||
| git push origin "${{ steps.get_version.outputs.version }}" || echo "Tag already pushed" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| git tag -a "${{ steps.get_version.outputs.version }}" -m "Release ${{ steps.get_version.outputs.version }}" | ||||||||||||||||||||||||||||||||
| git push origin "${{ steps.get_version.outputs.version }}" | ||||||||||||||||||||||||||||||||
|
Comment on lines
+62
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropping the |
||||||||||||||||||||||||||||||||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.