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:
parent
5cc7ebb73d
commit
ac0749f5a2
2 changed files with 7 additions and 2 deletions
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -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}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue