Repository navigation
fix(publish): keep newest result artifact when a publish job is restarted - #244
Merged
Merged
Conversation
…rted When a publish job is cancelled and restarted, the run ends up with two artifacts with the same name (for example publish-result-csharp-src). The summary job downloaded them with merge-multiple, which extracts every match into one directory in no guaranteed order, so the stale "failed" fragment overwrote the newer "published" one. The release notes then showed "publish failed" for packs that had published (seen on v0.8.3 for the C# and Go query packs). Replace the download step with download-latest-publish-results.sh, which lists the run's artifacts via the API and downloads only the newest non-expired one per name. The summary job needs actions: read for that listing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to use the latest publish results after job restarts.
No open issues 🎉
What changed in this PR
This PR makes publish summaries use the newest result for each pack after a job is restarted, preventing older failure results from overwriting newer successful results.
Changes:
- Adds a script that selects the newest non-expired artifact per
publish-result-*name and extracts the results into one directory. - Updates the summary job to use the script with
actions: readpermission, while retainingcontinue-on-error: true.
| File | Description |
|---|---|
.github/workflows/publish.yml |
Uses the new downloader and grants permission to read artifacts. |
.github/scripts/download-latest-publish-results.sh |
Selects and downloads the newest non-expired publish result per artifact name. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
Publish summaryjob now downloads only the newest result artifact per name, instead of usingactions/download-artifactwithmerge-multiple: true.Why
Cancelling and restarting a publish job leaves two artifacts with the same name in the run (for example
publish-result-csharp-src).merge-multipleextracts all matches into one directory in no guaranteed order, so the stalefailedfragment from the cancelled attempt overwrote the newerpublishedone.Observed on the v0.8.3 release: the C# and Go query packs were published (
0.8.3is present in GHCR), but the release notes table showed "publish failed (still 0.8.2)" for both. The two artifacts per pack were:codeql-csharp-queriesfailed(19:23:35Z)published(19:33:23Z)codeql-go-queriesfailed(19:23:30Z)published(19:28:35Z)Changes
.github/scripts/download-latest-publish-results.sh <run-id> <dest-dir>: lists the run'spublish-result-*artifacts via the API, keeps the newest non-expired one per name, and extracts them into a flat directory. It also works locally (usesghauth), so a summary can be rebuilt for a past run while its artifacts are still within the 1 day retention.publish.ymlsummary job: uses the script (stillcontinue-on-error: true) and addsactions: read, which listing artifacts throughGITHUB_TOKENrequires.Testing
Ran the script against the affected run, rebuilt the summary with
build-publish-summary.sh, and upserted it into the v0.8.3 release withupsert-release-table.sh. 20 fragments were downloaded, nopublish failedcells remain, and both marker blocks in the release body are intact.Scope note: this does not change how the release or tag is created.