refactor: collapse the duplicated zip extract branches

Both branches called extractZip with the same destination after the
install rewrite, so only the source path differs now.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4eaf86fa-a85b-41f6-8763-612acc1ccc39
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2026-08-29 15:37:33 -03:00
co-authored by Copilot
parent fa7c11c5a3
commit 52910df325
2 changed files with 7 additions and 8 deletions
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -7
View File
@@ -16,7 +16,7 @@ export async function install(distribution: string, version: string, cacheBinary
const tag = release.tag_name;
const toolVersion = tag.replace(/^v/, '');
const toolPath: string = tc.find(distribution, toolVersion);
const toolPath = tc.find(distribution, toolVersion);
if (toolPath) {
core.info(`GoReleaser ${tag} found in the runner tool cache: ${toolPath}`);
return getExePath(toolPath);
@@ -46,13 +46,12 @@ export async function install(distribution: string, version: string, cacheBinary
core.info('Extracting GoReleaser');
await io.rmRF(extPath);
if (context.osPlat == 'win32') {
if (!downloadPath.endsWith('.zip')) {
const newPath = downloadPath + '.zip';
fs.renameSync(downloadPath, newPath);
await tc.extractZip(newPath, extPath);
} else {
await tc.extractZip(downloadPath, extPath);
let zipPath = downloadPath;
if (!zipPath.endsWith('.zip')) {
zipPath = `${downloadPath}.zip`;
fs.renameSync(downloadPath, zipPath);
}
await tc.extractZip(zipPath, extPath);
} else {
await tc.extractTar(downloadPath, extPath);
}