Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract archive fix #242

Closed
wants to merge 16 commits into from
2 changes: 1 addition & 1 deletion .licenses/npm/@actions/cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@actions/http-client-2.0.1.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .licenses/npm/@actions/tool-cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

388 changes: 189 additions & 199 deletions dist/cache-save/index.js

Large diffs are not rendered by default.

6,994 changes: 3,841 additions & 3,153 deletions dist/setup/index.js

Large diffs are not rendered by default.

90 changes: 63 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^2.0.2",
"@actions/cache": "^3.0.0",
"@actions/core": "^1.6.0",
"@actions/exec": "^1.1.0",
"@actions/glob": "^0.2.0",
"@actions/http-client": "^1.0.6",
"@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.5",
"@actions/tool-cache": "^2.0.1",
"semver": "^6.1.1"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/cache-restore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const restoreCache = async (

if (!cacheKey) {
core.info(`Cache is not found`);
core.setOutput(Outputs.CacheHit, false);
return;
}

Expand Down
15 changes: 4 additions & 11 deletions src/cache-save.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,11 @@ const cachePackages = async () => {
return;
}

try {
await cache.saveCache(cachePaths, primaryKey);
core.info(`Cache saved with the key: ${primaryKey}`);
} catch (error) {
if (error.name === cache.ValidationError.name) {
throw error;
} else if (error.name === cache.ReserveCacheError.name) {
core.info(error.message);
} else {
core.warning(`${error.message}`);
}
const cacheId = await cache.saveCache(cachePaths, primaryKey);
if (cacheId === -1) {
return;
}
core.info(`Cache saved with the key: ${primaryKey}`);
};

export function logWarning(message: string): void {
Expand Down
8 changes: 7 additions & 1 deletion src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,13 @@ async function installGoVersion(
auth: string | undefined
): Promise<string> {
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
const downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
let downloadPath: string;
const platform = os.platform();
if (platform === 'win32') {
downloadPath = await tc.downloadTool(info.downloadUrl, info.fileName, auth);
} else {
downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);
}

core.info('Extracting Go...');
let extPath = await extractGoArchive(downloadPath);
Expand Down