Skip to content

Commit

Permalink
update: update CI
Browse files Browse the repository at this point in the history
  • Loading branch information
asjdf committed Jul 22, 2024
1 parent 5acc7a7 commit 9e53719
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ jobs:
with:
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: false
cache-sdk: false

- name: verify go
run: __tests__/verify-go.sh "1.22.5"
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ inputs:
default: true
cache-dependency-path:
description: 'Used to specify the path to a dependency file - go.sum'
cache-sdk:
description: "Used to specify whether caching SDK is needed."
default: true
architecture:
description: 'Target architecture for Go to use. Examples: x86, x64. Will use system architecture by default.'
outputs:
Expand Down
32 changes: 20 additions & 12 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,33 @@ export async function getGo(
}
}

// check cache
const toolPath = tc.find('go', versionSpec, arch);
// If not found in cache, download
if (toolPath) {
core.info(`Found in cache @ ${toolPath}`);
return toolPath;
const cacheSDK = core.getBooleanInput('cache-sdk');
if (cacheSDK) {
// check cache
const toolPath = tc.find('go', versionSpec, arch);
// If not found in cache, download
if (toolPath) {
core.info(`Found in cache @ ${toolPath}`);
return toolPath;
}
}

core.info(`Attempting to download ${versionSpec}...`);
let downloadPath = '';
let info: IGoVersionInfo | null = null;

if (!downloadPath && goUrl) {
try {
downloadPath = await installGoVersion({
type: 'dist',
downloadUrl: goUrl,
resolvedVersion: 'custom',
fileName: goUrl.match(/\/([^\/?#]+)(?:[?#]|$)/i)?.[1] || ''
}, auth, arch);
downloadPath = await installGoVersion(
{
type: 'dist',
downloadUrl: goUrl,
resolvedVersion: 'custom',
fileName: goUrl.match(/\/([^\/?#]+)(?:[?#]|$)/i)?.[1] || ''

Check failure on line 108 in src/installer.ts

View workflow job for this annotation

GitHub Actions / Basic validation / build (ubuntu-latest)

Unnecessary escape character: \/

Check failure on line 108 in src/installer.ts

View workflow job for this annotation

GitHub Actions / Basic validation / build (macos-latest)

Unnecessary escape character: \/

Check failure on line 108 in src/installer.ts

View workflow job for this annotation

GitHub Actions / Basic validation / build (windows-latest)

Unnecessary escape character: \/
},
auth,
arch
);
} catch (err) {
if (
err instanceof tc.HTTPError &&
Expand Down

0 comments on commit 9e53719

Please sign in to comment.