fix: handle 'latest' version
This commit is contained in:
parent
045c79efbf
commit
4431e4a952
4 changed files with 14 additions and 13 deletions
|
@ -15,7 +15,7 @@ describe('Asset lookup', () => {
|
|||
const release = await octoVersionDetermination.getRelease(
|
||||
Hugo.Org,
|
||||
Hugo.Repo,
|
||||
'',
|
||||
'latest',
|
||||
HugoReleaseTransformer
|
||||
)
|
||||
expect(release.tag_name).toMatch(new RegExp('\\d+.\\d+.\\d+'))
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
|
@ -49221,7 +49221,7 @@ class OctokitReleaseLookup {
|
|||
this.octokit = new dist_node.Octokit({ auth: pat });
|
||||
}
|
||||
async getRelease(owner, repo, version, transformer) {
|
||||
const latestRelease = version
|
||||
const latestRelease = version && version !== 'latest'
|
||||
? await this.octokit.rest.repos.getReleaseByTag({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -31,16 +31,17 @@ export class OctokitReleaseLookup implements IReleaseLookup {
|
|||
version: string | undefined,
|
||||
transformer: IReleaseTransformer<T>
|
||||
): Promise<T> {
|
||||
const latestRelease = version
|
||||
? await this.octokit.rest.repos.getReleaseByTag({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
tag: version
|
||||
})
|
||||
: await this.octokit.rest.repos.getLatestRelease({
|
||||
owner: owner,
|
||||
repo: repo
|
||||
})
|
||||
const latestRelease =
|
||||
version && version !== 'latest'
|
||||
? await this.octokit.rest.repos.getReleaseByTag({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
tag: version
|
||||
})
|
||||
: await this.octokit.rest.repos.getLatestRelease({
|
||||
owner: owner,
|
||||
repo: repo
|
||||
})
|
||||
return transformer.map(latestRelease.data)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue