13
0
Fork 0
mirror of https://github.com/goreleaser/goreleaser-action.git synced 2026-07-02 19:19:34 +00:00

fix(nightly): pick latest nightly by published_at

GitHub's /releases endpoint is not reliably ordered by published_at,
so resolveNightly could pick an older nightly than the most recent
one. Filter, sort by published_at desc, and take the first.
This commit is contained in:
copilot-swe-agent[bot] 2026-05-18 01:57:44 +00:00 committed by GitHub
parent 5cc7ebb73d
commit ac0749f5a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

View file

@ -28,6 +28,7 @@ const withRetry = async <T>(operation: () => Promise<T>): Promise<T> => {
export interface GitHubRelease {
tag_name: string;
published_at?: string;
}
// Matches the new-style nightly release tag pattern: vX.Y.Z-<sha>-nightly
@ -113,7 +114,11 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
return <Array<GitHubRelease>>JSON.parse(body);
});
const match = releases.find(r => nightlyTagRegex.test(r.tag_name));
// GitHub's /releases endpoint is not reliably ordered by published_at, so sort explicitly.
const match = releases
.filter(r => nightlyTagRegex.test(r.tag_name))
.sort((a, b) => (b.published_at || '').localeCompare(a.published_at || ''))
.shift();
if (!match) {
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
}