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(
|
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
2
dist/index.js
vendored
|
@ -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
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue