mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-14 13:16:16 -08:00
ci(release): rebuild full draft metadata after asset upload
Extend the post-upload metadata step to also rebuild the body (context header + notes from the same generate-notes API the action uses), not just title/commitish. The rolling draft now ends up with correct metadata regardless of which internal action-gh-release path ran, including the rare canonicalize-duplicate fallback. If notes generation fails, the body is left as the action set it. Addresses Codex round-4 feedback on #1202. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3512bfb998
commit
1b4d276e17
1 file changed
+35
-6
@@ -947,22 +947,51 @@ jobs:
|
||||
# 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.
|
||||
# there WITHOUT refreshing that draft's metadata. Rebuild the full
|
||||
# metadata (title, commitish, and body = context header + notes
|
||||
# from the same generate-notes API the action uses) on the release
|
||||
# id the action actually used, so the draft ends up correct no
|
||||
# matter which internal path ran. If notes generation fails, the
|
||||
# body is left as the action set it and only title/commitish are
|
||||
# re-asserted.
|
||||
- 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_TAG: ${{ steps.release-meta.outputs.tag }}
|
||||
RELEASE_NAME: ${{ steps.release-meta.outputs.name }}
|
||||
RELEASE_COMMITISH: ${{ steps.release-meta.outputs.commitish }}
|
||||
RELEASE_BODY: ${{ steps.release-meta.outputs.body }}
|
||||
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
|
||||
GENERATED_NOTES="$(gh api -X POST "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
|
||||
-f tag_name="${RELEASE_TAG}" \
|
||||
-f target_commitish="${RELEASE_COMMITISH}" \
|
||||
--jq '.body' || true)"
|
||||
|
||||
if [ -z "${GENERATED_NOTES}" ]; then
|
||||
jq -n \
|
||||
--arg name "${RELEASE_NAME}" \
|
||||
--arg commitish "${RELEASE_COMMITISH}" \
|
||||
'{name: $name, target_commitish: $commitish}' |
|
||||
gh api -X PATCH "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --input - > /dev/null
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "${RELEASE_BODY}" ]; then
|
||||
FULL_BODY="$(printf '%s\n\n%s' "${RELEASE_BODY}" "${GENERATED_NOTES}")"
|
||||
else
|
||||
FULL_BODY="${GENERATED_NOTES}"
|
||||
fi
|
||||
|
||||
jq -n \
|
||||
--arg name "${RELEASE_NAME}" \
|
||||
--arg commitish "${RELEASE_COMMITISH}" \
|
||||
--arg body "${FULL_BODY}" \
|
||||
'{name: $name, target_commitish: $commitish, body: ($body | .[0:120000])}' |
|
||||
gh api -X PATCH "repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" --input - > /dev/null
|
||||
|
||||
publish-snap:
|
||||
name: Publish to Snapcraft Store
|
||||
|
||||
Reference in new issue
Block a user