From 4dd950a8ee6b3f05bfd2549a98cbd3532dc4031c Mon Sep 17 00:00:00 2001 From: 4gray Date: Sat, 18 Jul 2026 16:39:53 +0200 Subject: [PATCH] ci(release): re-assert rolling draft title after asset upload action-gh-release@v2 updates name/body/target_commitish on the normal draft-reuse path, but in a rare race (release listing transiently missing the draft) it uploads assets to the canonical oldest draft without refreshing its metadata. PATCH the title and commitish on the release id the action actually used, so the draft title always names the current head SHA; the body is left alone to preserve generated notes. Addresses Codex round-2 feedback on #1202. Co-Authored-By: Claude Fable 5 --- .github/workflows/build-and-make.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build-and-make.yaml b/.github/workflows/build-and-make.yaml index 7597a5b55..d77a07b93 100644 --- a/.github/workflows/build-and-make.yaml +++ b/.github/workflows/build-and-make.yaml @@ -880,6 +880,7 @@ jobs: echo "state=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}" --jq '.state')" >> "${GITHUB_OUTPUT}" - name: Create Draft Release + id: draft-release if: github.event_name != 'pull_request' || steps.pr-state.outputs.state == 'open' uses: softprops/action-gh-release@v2 with: @@ -915,6 +916,26 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Rare action-gh-release path: when the release listing transiently + # misses the rolling draft, the action creates a duplicate, deletes + # it in favor of the canonical (oldest) draft, and uploads assets + # there WITHOUT refreshing that draft's metadata. Re-assert the + # composed title and commitish on whatever release the action ended + # up using; the body is left alone to preserve generated notes. + - name: Ensure draft metadata is current + if: steps.draft-release.outputs.id != '' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_ID: ${{ steps.draft-release.outputs.id }} + RELEASE_NAME: ${{ steps.release-meta.outputs.name }} + RELEASE_COMMITISH: ${{ steps.release-meta.outputs.commitish }} + run: | + set -euo pipefail + + gh api -X PATCH "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" \ + -f name="${RELEASE_NAME}" \ + -f target_commitish="${RELEASE_COMMITISH}" > /dev/null + publish-snap: name: Publish to Snapcraft Store needs: build