Closed elibosley closed 1 year ago
Yes, latest
is totally misleading! Because one assumes, that the workflow will download the latest release in a timely meaning and not that there needs to be a release version with the name latest
. The default value doesn't make much sense, because there isn't necessarily a release version latest
. The documentation should be made clearer.
I think the problem is that the value of version
doesn't actually default to latest:
const version = core.getInput('version', { required: false });
const getRelease = (
octokit: ReturnType<typeof github.getOctokit>,
{ owner, repo, version }: GetReleaseOptions
) => {
const tagsMatch = version.match(/^tags\/(.*)$/);
if (version === 'latest') {
return octokit.rest.repos.getLatestRelease({ owner, repo });
} else if (tagsMatch !== null && tagsMatch[1]) {
return octokit.rest.repos.getReleaseByTag({
owner,
repo,
tag: tagsMatch[1],
});
} else {
return octokit.rest.repos.getRelease({
owner,
repo,
release_id: Math.trunc(Number(version)),
});
}
};
By changing it to
const version = core.getInput('version', { required: false }) || 'latest';
It should actually fetch the latest (chronologically speaking) version released when the version
parameter is not present.
This is now fixed if you point your job to master
.
New version with this fix released https://github.com/dsaltares/fetch-gh-release-asset/releases/tag/1.1.1
In the readme it says:
But from reading the code and my own testing it doesn't actually default to using latest. Maybe just update readme to say that latest is an option but not that it defaults to that?
Btw I love this workflow thank you for making this!