From 39cd14951b08e74b54015e9e001cdefcf80e669f Mon Sep 17 00:00:00 2001 From: gowridurgad <159780674+gowridurgad@users.noreply.github.com> Date: Wed, 10 Jul 2024 19:18:13 +0530 Subject: [PATCH 1/4] Documentation update for cache (#873) * updated doc * added note * modify1 * Update advanced-usage.md * Update 0000-caching-dependencies.md --------- Co-authored-by: gowridurgad --- docs/adrs/0000-caching-dependencies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/adrs/0000-caching-dependencies.md b/docs/adrs/0000-caching-dependencies.md index 8a172a07..7f9e4d04 100644 --- a/docs/adrs/0000-caching-dependencies.md +++ b/docs/adrs/0000-caching-dependencies.md @@ -18,7 +18,7 @@ Integration of caching functionality into `actions/setup-python` action will bri We will add support for Pip and Pipenv dependency caching. -We won't pursue the goal to provide wide customization of caching in the scope of `actions/setup-python` action. The purpose of this integration is to cover ~90% of basic use-cases. If users need flexible customization, we will advise them to use `actions/cache` directly. +We won't pursue the goal to provide wide customization of caching in the scope of `actions/setup-python` action. The purpose of this integration is to cover ~90% of basic use-cases. The action does not support dependency-specific caching for each job. If different dependencies are installed across jobs the cache from the first job will be used in the second job. To manage this aspect, users should create separate caches for jobs with different requirements. If users need flexible customization, we will advise them to use `actions/cache` directly. ## Decision From cb6845644151e35f879e10f2f0896c3c8bee372c Mon Sep 17 00:00:00 2001 From: priya-kinthali <147703874+priya-kinthali@users.noreply.github.com> Date: Tue, 23 Jul 2024 00:20:49 +0530 Subject: [PATCH 2/4] Updated @iarna/toml version to 3.0.0 (#912) --- .licenses/npm/@iarna/toml.dep.yml | 2 +- dist/setup/index.js | 134 +++++++++++++++++------------- package-lock.json | 8 +- package.json | 2 +- 4 files changed, 81 insertions(+), 65 deletions(-) diff --git a/.licenses/npm/@iarna/toml.dep.yml b/.licenses/npm/@iarna/toml.dep.yml index 82e52eeb..11f39798 100644 --- a/.licenses/npm/@iarna/toml.dep.yml +++ b/.licenses/npm/@iarna/toml.dep.yml @@ -1,6 +1,6 @@ --- name: "@iarna/toml" -version: 2.2.5 +version: 3.0.0 type: npm summary: Better TOML parsing and stringifying all in that familiar JSON interface. homepage: https://github.com/iarna/iarna-toml#readme diff --git a/dist/setup/index.js b/dist/setup/index.js index e28c3be0..039a5f5b 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -46726,7 +46726,7 @@ function makeParserClass (Parser) { let target = this.ctx let finalKey = kv.key.pop() for (let kw of kv.key) { - if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { + if (hasKey(target, kw) && !isTable(target[kw])) { throw this.error(new TomlError("Can't redefine existing key")) } target = target[kw] = target[kw] || Table() @@ -46734,6 +46734,7 @@ function makeParserClass (Parser) { if (hasKey(target, finalKey)) { throw this.error(new TomlError("Can't redefine existing key")) } + target[_declared] = true // unbox our numbers if (isInteger(kv.value) || isFloat(kv.value)) { target[finalKey] = kv.value.valueOf() @@ -46791,6 +46792,8 @@ function makeParserClass (Parser) { do { if (this.char === Parser.END || this.char === CTRL_J) { return this.return() + } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)) { + throw this.errorControlCharIn('comments') } } while (this.nextChar()) } @@ -47004,7 +47007,7 @@ function makeParserClass (Parser) { } else if (this.atEndOfLine()) { throw this.error(new TomlError('Unterminated string')) } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)) { - throw this.errorControlCharInString() + throw this.errorControlCharIn('strings') } else { this.consume() } @@ -47033,7 +47036,7 @@ function makeParserClass (Parser) { } else if (this.char === Parser.END) { throw this.error(new TomlError('Unterminated multi-line string')) } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)) { - throw this.errorControlCharInString() + throw this.errorControlCharIn('strings') } else { this.consume() } @@ -47049,12 +47052,28 @@ function makeParserClass (Parser) { } parseLiteralMultiEnd2 () { if (this.char === CHAR_APOS) { - return this.return() + return this.next(this.parseLiteralMultiEnd3) } else { this.state.buf += "''" return this.goto(this.parseLiteralMultiStringContent) } } + parseLiteralMultiEnd3 () { + if (this.char === CHAR_APOS) { + this.state.buf += "'" + return this.next(this.parseLiteralMultiEnd4) + } else { + return this.returnNow() + } + } + parseLiteralMultiEnd4 () { + if (this.char === CHAR_APOS) { + this.state.buf += "'" + return this.return() + } else { + return this.returnNow() + } + } /* STRINGS double quoted */ parseDoubleString () { @@ -47073,7 +47092,7 @@ function makeParserClass (Parser) { } else if (this.atEndOfLine()) { throw this.error(new TomlError('Unterminated string')) } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)) { - throw this.errorControlCharInString() + throw this.errorControlCharIn('strings') } else { this.consume() } @@ -47108,20 +47127,20 @@ function makeParserClass (Parser) { } else if (this.char === Parser.END) { throw this.error(new TomlError('Unterminated multi-line string')) } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)) { - throw this.errorControlCharInString() + throw this.errorControlCharIn('strings') } else { this.consume() } } while (this.nextChar()) } - errorControlCharInString () { + errorControlCharIn (type) { let displayCode = '\\u00' if (this.char < 16) { displayCode += '0' } displayCode += this.char.toString(16) - return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`)) + return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in ${type}, use ${displayCode} instead`)) } recordMultiEscapeReplacement (replacement) { this.state.buf += replacement @@ -47137,12 +47156,28 @@ function makeParserClass (Parser) { } parseMultiEnd2 () { if (this.char === CHAR_QUOT) { - return this.return() + return this.next(this.parseMultiEnd3) } else { this.state.buf += '""' return this.goto(this.parseMultiStringContent) } } + parseMultiEnd3 () { + if (this.char === CHAR_QUOT) { + this.state.buf += '"' + return this.next(this.parseMultiEnd4) + } else { + return this.returnNow() + } + } + parseMultiEnd4 () { + if (this.char === CHAR_QUOT) { + this.state.buf += '"' + return this.return() + } else { + return this.returnNow() + } + } parseMultiEscape () { if (this.char === CTRL_M || this.char === CTRL_J) { return this.next(this.parseMultiTrim) @@ -47704,13 +47739,7 @@ function makeParserClass (Parser) { } } recordInlineListValue (value) { - if (this.state.resultArr) { - const listType = this.state.resultArr[_contentType] - const valueType = tomlType(value) - if (listType !== valueType) { - throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`)) - } - } else { + if (!this.state.resultArr) { this.state.resultArr = InlineList(tomlType(value)) } if (isFloat(value) || isInteger(value)) { @@ -47773,13 +47802,26 @@ function makeParserClass (Parser) { } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { throw this.error(new TomlError('Unterminated inline array')) } else if (this.char === CHAR_COMMA) { - return this.next(this.parseInlineTable) + return this.next(this.parseInlineTablePostComma) } else if (this.char === CHAR_RCUB) { return this.goto(this.parseInlineTable) } else { throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])')) } } + parseInlineTablePostComma () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { + throw this.error(new TomlError('Unterminated inline array')) + } else if (this.char === CHAR_COMMA) { + throw this.error(new TomlError('Empty elements in inline tables are not permitted')) + } else if (this.char === CHAR_RCUB) { + throw this.error(new TomlError('Trailing commas in inline tables are not permitted')) + } else { + return this.goto(this.parseInlineTable) + } + } } return TOMLParser } @@ -48017,10 +48059,6 @@ function typeError (type) { return new Error('Can only stringify objects, not ' + type) } -function arrayOneTypeError () { - return new Error("Array values can't have mixed types") -} - function getInlineKeys (obj) { return Object.keys(obj).filter(key => isInline(obj[key])) } @@ -48042,12 +48080,12 @@ function toJSON (obj) { function stringifyObject (prefix, indent, obj) { obj = toJSON(obj) - var inlineKeys - var complexKeys + let inlineKeys + let complexKeys inlineKeys = getInlineKeys(obj) complexKeys = getComplexKeys(obj) - var result = [] - var inlineIndent = indent || '' + const result = [] + const inlineIndent = indent || '' inlineKeys.forEach(key => { var type = tomlType(obj[key]) if (type !== 'undefined' && type !== 'null') { @@ -48055,7 +48093,7 @@ function stringifyObject (prefix, indent, obj) { } }) if (result.length > 0) result.push('') - var complexIndent = prefix && inlineKeys.length > 0 ? indent + ' ' : '' + const complexIndent = prefix && inlineKeys.length > 0 ? indent + ' ' : '' complexKeys.forEach(key => { result.push(stringifyComplex(prefix, complexIndent, key, obj[key])) }) @@ -48107,7 +48145,7 @@ function tomlType (value) { } function stringifyKey (key) { - var keyStr = String(key) + const keyStr = String(key) if (/^[-A-Za-z0-9_]+$/.test(keyStr)) { return keyStr } else { @@ -48203,9 +48241,7 @@ function stringifyFloat (value) { } else if (Object.is(value, -0)) { return '-0.0' } - var chunks = String(value).split('.') - var int = chunks[0] - var dec = chunks[1] || 0 + const [int, dec] = String(value).split('.') return stringifyInteger(int) + '.' + dec } @@ -48217,29 +48253,10 @@ function stringifyDatetime (value) { return value.toISOString() } -function isNumber (type) { - return type === 'float' || type === 'integer' -} -function arrayType (values) { - var contentType = tomlType(values[0]) - if (values.every(_ => tomlType(_) === contentType)) return contentType - // mixed integer/float, emit as floats - if (values.every(_ => isNumber(tomlType(_)))) return 'float' - return 'mixed' -} -function validateArray (values) { - const type = arrayType(values) - if (type === 'mixed') { - throw arrayOneTypeError() - } - return type -} - function stringifyInlineArray (values) { values = toJSON(values) - const type = validateArray(values) - var result = '[' - var stringified = values.map(_ => stringifyInline(_, type)) + let result = '[' + const stringified = values.map(_ => stringifyInline(_)) if (stringified.join(', ').length > 60 || /\n/.test(stringified)) { result += '\n ' + stringified.join(',\n ') + '\n' } else { @@ -48250,7 +48267,7 @@ function stringifyInlineArray (values) { function stringifyInlineTable (value) { value = toJSON(value) - var result = [] + const result = [] Object.keys(value).forEach(key => { result.push(stringifyKey(key) + ' = ' + stringifyAnyInline(value[key], false)) }) @@ -48258,7 +48275,7 @@ function stringifyInlineTable (value) { } function stringifyComplex (prefix, indent, key, value) { - var valueType = tomlType(value) + const valueType = tomlType(value) /* istanbul ignore else */ if (valueType === 'array') { return stringifyArrayOfTables(prefix, indent, key, value) @@ -48271,12 +48288,11 @@ function stringifyComplex (prefix, indent, key, value) { function stringifyArrayOfTables (prefix, indent, key, values) { values = toJSON(values) - validateArray(values) - var firstValueType = tomlType(values[0]) + const firstValueType = tomlType(values[0]) /* istanbul ignore if */ if (firstValueType !== 'table') throw typeError(firstValueType) - var fullKey = prefix + stringifyKey(key) - var result = '' + const fullKey = prefix + stringifyKey(key) + let result = '' values.forEach(table => { if (result.length > 0) result += '\n' result += indent + '[[' + fullKey + ']]\n' @@ -48286,8 +48302,8 @@ function stringifyArrayOfTables (prefix, indent, key, values) { } function stringifyComplexTable (prefix, indent, key, value) { - var fullKey = prefix + stringifyKey(key) - var result = '' + const fullKey = prefix + stringifyKey(key) + let result = '' if (getInlineKeys(value).length > 0) { result += indent + '[' + fullKey + ']\n' } diff --git a/package-lock.json b/package-lock.json index b2695779..e5b2190b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@actions/http-client": "^2.2.1", "@actions/io": "^1.0.2", "@actions/tool-cache": "^2.0.1", - "@iarna/toml": "^2.2.5", + "@iarna/toml": "^3.0.0", "semver": "^7.6.0" }, "devDependencies": { @@ -1084,9 +1084,9 @@ "dev": true }, "node_modules/@iarna/toml": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz", - "integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-3.0.0.tgz", + "integrity": "sha512-td6ZUkz2oS3VeleBcN+m//Q6HlCFCPrnI0FZhrt/h4XqLEdOyYp2u21nd8MdsR+WJy5r9PTDaHTDDfhf4H4l6Q==" }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", diff --git a/package.json b/package.json index c9147771..f7c3ef48 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@actions/http-client": "^2.2.1", "@actions/io": "^1.0.2", "@actions/tool-cache": "^2.0.1", - "@iarna/toml": "^2.2.5", + "@iarna/toml": "^3.0.0", "semver": "^7.6.0" }, "devDependencies": { From 04c1311429f7be71707d8ab66c7af8a14e54b938 Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Tue, 23 Jul 2024 07:16:08 -0700 Subject: [PATCH 3/4] Fix display of emojis in contributors doc (#899) --- docs/contributors.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/contributors.md b/docs/contributors.md index dc3d8b38..6084cb4b 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -6,13 +6,13 @@ We have prepared a short guide so that the process of making your contribution i ## How can I contribute... -* [Contribute Documentation:green_book:](#contribute-documentation) +* [Contribute Documentation :green_book:](#contribute-documentation) * [Contribute Code :computer:](#contribute-code) -* [Provide Support on Issues:pencil:](#provide-support-on-issues) +* [Provide Support on Issues :pencil:](#provide-support-on-issues) -* [Review Pull Requests:mag:](#review-pull-requests) +* [Review Pull Requests :mag:](#review-pull-requests) ## Contribute documentation From 036a5236741fd24c89eea80d1b76179e8e5f9214 Mon Sep 17 00:00:00 2001 From: Priya Gupta <147705955+priyagupta108@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:53:34 +0530 Subject: [PATCH 4/4] Fix: Add `.zip` extension to Windows package downloads for `Expand-Archive` Compatibility (#916) * Fix: specify filename during Windows package download * Changed unit test download urls --- __tests__/utils.test.ts | 38 +++++++++++++++++++++++++++++++++++++- dist/setup/index.js | 22 +++++++++++++++++++--- src/install-pypy.ts | 6 ++++-- src/install-python.ts | 5 +++-- src/utils.ts | 14 ++++++++++++++ 5 files changed, 77 insertions(+), 8 deletions(-) diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index f5e36478..c2c6bca5 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -12,7 +12,9 @@ import { getVersionInputFromFile, getVersionInputFromPlainFile, getVersionInputFromTomlFile, - getNextPageUrl + getNextPageUrl, + IS_WINDOWS, + getDownloadFileName } from '../src/utils'; jest.mock('@actions/cache'); @@ -159,3 +161,37 @@ describe('getNextPageUrl', () => { expect(getNextPageUrl(generateResponse(page2Links))).toBeNull(); }); }); + +describe('getDownloadFileName', () => { + const originalEnv = process.env; + const tempDir = path.join(__dirname, 'runner', 'temp'); + + beforeEach(() => { + process.env = {...originalEnv}; + }); + + afterEach(() => { + process.env = originalEnv; + }); + + it('should return the correct path on Windows', () => { + if (IS_WINDOWS) { + process.env['RUNNER_TEMP'] = tempDir; + const downloadUrl = + 'https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-win32-x64.zip'; + const expectedPath = path.join( + process.env.RUNNER_TEMP, + path.basename(downloadUrl) + ); + expect(getDownloadFileName(downloadUrl)).toBe(expectedPath); + } + }); + + it('should return undefined on non-Windows', () => { + if (!IS_WINDOWS) { + const downloadUrl = + 'https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-linux-x64.tar.gz'; + expect(getDownloadFileName(downloadUrl)).toBeUndefined(); + } + }); +}); diff --git a/dist/setup/index.js b/dist/setup/index.js index 039a5f5b..e3bb93ba 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -91441,7 +91441,8 @@ function installPyPy(pypyVersion, pythonVersion, architecture, allowPreReleases, const downloadUrl = `${foundAsset.download_url}`; core.info(`Downloading PyPy from "${downloadUrl}" ...`); try { - const pypyPath = yield tc.downloadTool(downloadUrl); + const fileName = (0, utils_1.getDownloadFileName)(downloadUrl); + const pypyPath = yield tc.downloadTool(downloadUrl, fileName); core.info('Extracting downloaded archive...'); if (utils_1.IS_WINDOWS) { downloadDir = yield tc.extractZip(pypyPath); @@ -91703,7 +91704,8 @@ function installCpythonFromRelease(release) { core.info(`Download from "${downloadUrl}"`); let pythonPath = ''; try { - pythonPath = yield tc.downloadTool(downloadUrl, undefined, AUTH); + const fileName = (0, utils_1.getDownloadFileName)(downloadUrl); + pythonPath = yield tc.downloadTool(downloadUrl, fileName, AUTH); core.info('Extract downloaded archive'); let pythonExtractedFolder; if (utils_1.IS_WINDOWS) { @@ -91938,7 +91940,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getNextPageUrl = exports.getBinaryDirectory = exports.getVersionInputFromFile = exports.getVersionInputFromPlainFile = exports.getVersionInputFromTomlFile = exports.getOSInfo = exports.getLinuxInfo = exports.logWarning = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0; +exports.getDownloadFileName = exports.getNextPageUrl = exports.getBinaryDirectory = exports.getVersionInputFromFile = exports.getVersionInputFromPlainFile = exports.getVersionInputFromTomlFile = exports.getOSInfo = exports.getLinuxInfo = exports.logWarning = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0; /* eslint no-unsafe-finally: "off" */ const cache = __importStar(__nccwpck_require__(7799)); const core = __importStar(__nccwpck_require__(2186)); @@ -92198,6 +92200,20 @@ function getNextPageUrl(response) { return null; } exports.getNextPageUrl = getNextPageUrl; +/** + * Add temporary fix for Windows + * On Windows, it is necessary to retain the .zip extension for proper extraction. + * because the tc.extractZip() failure due to tc.downloadTool() not adding .zip extension. + * Related issue: https://github.com/actions/toolkit/issues/1179 + * Related issue: https://github.com/actions/setup-python/issues/819 + */ +function getDownloadFileName(downloadUrl) { + const tempDir = process.env.RUNNER_TEMP || '.'; + return exports.IS_WINDOWS + ? path.join(tempDir, path.basename(downloadUrl)) + : undefined; +} +exports.getDownloadFileName = getDownloadFileName; /***/ }), diff --git a/src/install-pypy.ts b/src/install-pypy.ts index b624f1d7..75922110 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -14,7 +14,8 @@ import { createSymlinkInFolder, isNightlyKeyword, writeExactPyPyVersionFile, - getBinaryDirectory + getBinaryDirectory, + getDownloadFileName } from './utils'; export async function installPyPy( @@ -69,7 +70,8 @@ export async function installPyPy( core.info(`Downloading PyPy from "${downloadUrl}" ...`); try { - const pypyPath = await tc.downloadTool(downloadUrl); + const fileName = getDownloadFileName(downloadUrl); + const pypyPath = await tc.downloadTool(downloadUrl, fileName); core.info('Extracting downloaded archive...'); if (IS_WINDOWS) { diff --git a/src/install-python.ts b/src/install-python.ts index 3abdfde3..d3421bf8 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -4,7 +4,7 @@ import * as tc from '@actions/tool-cache'; import * as exec from '@actions/exec'; import * as httpm from '@actions/http-client'; import {ExecOptions} from '@actions/exec/lib/interfaces'; -import {IS_WINDOWS, IS_LINUX} from './utils'; +import {IS_WINDOWS, IS_LINUX, getDownloadFileName} from './utils'; const TOKEN = core.getInput('token'); const AUTH = !TOKEN ? undefined : `token ${TOKEN}`; @@ -98,7 +98,8 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) { core.info(`Download from "${downloadUrl}"`); let pythonPath = ''; try { - pythonPath = await tc.downloadTool(downloadUrl, undefined, AUTH); + const fileName = getDownloadFileName(downloadUrl); + pythonPath = await tc.downloadTool(downloadUrl, fileName, AUTH); core.info('Extract downloaded archive'); let pythonExtractedFolder; if (IS_WINDOWS) { diff --git a/src/utils.ts b/src/utils.ts index 644b4af5..3d1b3dff 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -310,3 +310,17 @@ export function getNextPageUrl(response: ifm.TypedResponse) { } return null; } + +/** + * Add temporary fix for Windows + * On Windows, it is necessary to retain the .zip extension for proper extraction. + * because the tc.extractZip() failure due to tc.downloadTool() not adding .zip extension. + * Related issue: https://github.com/actions/toolkit/issues/1179 + * Related issue: https://github.com/actions/setup-python/issues/819 + */ +export function getDownloadFileName(downloadUrl: string): string | undefined { + const tempDir = process.env.RUNNER_TEMP || '.'; + return IS_WINDOWS + ? path.join(tempDir, path.basename(downloadUrl)) + : undefined; +}