fix: handle 'latest' version
Some checks failed
Check Transpiled JavaScript / Check dist/ (push) Has been cancelled
Continuous Integration / TypeScript Tests (push) Has been cancelled
Continuous Integration / GitHub Actions Test (push) Has been cancelled

This commit is contained in:
Peter 2024-05-02 19:36:40 +02:00
parent 045c79efbf
commit 4431e4a952
Signed by: prskr
GPG key ID: F56BED6903BC5E37
4 changed files with 14 additions and 13 deletions

View file

@ -15,7 +15,7 @@ describe('Asset lookup', () => {
const release = await octoVersionDetermination.getRelease( const release = await octoVersionDetermination.getRelease(
Hugo.Org, Hugo.Org,
Hugo.Repo, Hugo.Repo,
'', 'latest',
HugoReleaseTransformer HugoReleaseTransformer
) )
expect(release.tag_name).toMatch(new RegExp('\\d+.\\d+.\\d+')) expect(release.tag_name).toMatch(new RegExp('\\d+.\\d+.\\d+'))

2
dist/index.js vendored
View file

@ -49221,7 +49221,7 @@ class OctokitReleaseLookup {
this.octokit = new dist_node.Octokit({ auth: pat }); this.octokit = new dist_node.Octokit({ auth: pat });
} }
async getRelease(owner, repo, version, transformer) { async getRelease(owner, repo, version, transformer) {
const latestRelease = version const latestRelease = version && version !== 'latest'
? await this.octokit.rest.repos.getReleaseByTag({ ? await this.octokit.rest.repos.getReleaseByTag({
owner: owner, owner: owner,
repo: repo, repo: repo,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -31,7 +31,8 @@ export class OctokitReleaseLookup implements IReleaseLookup {
version: string | undefined, version: string | undefined,
transformer: IReleaseTransformer<T> transformer: IReleaseTransformer<T>
): Promise<T> { ): Promise<T> {
const latestRelease = version const latestRelease =
version && version !== 'latest'
? await this.octokit.rest.repos.getReleaseByTag({ ? await this.octokit.rest.repos.getReleaseByTag({
owner: owner, owner: owner,
repo: repo, repo: repo,