From b70ec41a341e466d9663692af6ab950eb3a389eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=88=90=E9=94=B4?= Date: Mon, 22 Jul 2024 15:32:20 +0800 Subject: [PATCH] fix: fix type error --- .github/workflows/versions.yml | 1 + action.yml | 2 ++ dist/setup/index.js | 5 ++++- src/installer.ts | 7 ++++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index e38afaf8c..d43dce6e2 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -207,6 +207,7 @@ jobs: go-url: 'https://github.com/actions/go-versions/releases/download/1.22.5-9771837482/go-1.22.5-linux-x64.tar.gz' go-version: 1.22.5 cache-sdk: false + go-url-type: 'manifest' - name: verify go run: __tests__/verify-go.sh "1.22.5" diff --git a/action.yml b/action.yml index 97fd5a98e..12f6896f0 100644 --- a/action.yml +++ b/action.yml @@ -4,6 +4,8 @@ author: 'GitHub' inputs: go-url: description: 'Download Go from url. Will ignore go-version and go-version-file.' + go-url-type: + description: 'dist or manifest' go-version: description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.' go-version-file: diff --git a/dist/setup/index.js b/dist/setup/index.js index 5855c9396..d31345533 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -88298,8 +88298,11 @@ function getGo(goUrl_1, versionSpec_1, checkLatest_1, auth_1) { let info = null; if (!downloadPath && goUrl) { try { + const type = ['dist', 'manifest'].includes(core.getInput('go-url-type')) + ? core.getInput('go-url-type') + : 'dist'; downloadPath = yield installGoVersion({ - type: 'dist', + type: type, downloadUrl: goUrl, resolvedVersion: versionSpec, fileName: ((_a = goUrl.match(/\/([^\/?#]+)(?:[?#]|$)/i)) === null || _a === void 0 ? void 0 : _a[1]) || '' diff --git a/src/installer.ts b/src/installer.ts index df19a3392..c467f316b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -100,9 +100,14 @@ export async function getGo( if (!downloadPath && goUrl) { try { + const type: InstallationType = ['dist', 'manifest'].includes( + core.getInput('go-url-type') + ) + ? (core.getInput('go-url-type') as InstallationType) + : 'dist'; downloadPath = await installGoVersion( { - type: 'dist', + type: type, downloadUrl: goUrl, resolvedVersion: versionSpec, fileName: goUrl.match(/\/([^\/?#]+)(?:[?#]|$)/i)?.[1] || ''