mirror of https://github.com/actions/setup-go.git
				
				
				
			Merge branch 'actions:main' into main
This commit is contained in:
		
						commit
						b5f0c3afd4
					
				|  | @ -7,7 +7,7 @@ assignees: '' | |||
| 
 | ||||
| --- | ||||
| 
 | ||||
| <!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 ---> | ||||
| <!--- Please direct any generic questions related to actions to our support community forum at https://github.com/orgs/community/discussions/categories/actions ---> | ||||
| <!--- Before opening up a new bug report, please make sure to check for similar existing issues --> | ||||
| 
 | ||||
| **Description:** | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ title: '' | |||
| labels: feature request, needs triage | ||||
| assignees: '' | ||||
| --- | ||||
| <!--- Please direct any generic questions related to actions to our support community forum at https://github.community/c/code-to-cloud/github-actions/41 ---> | ||||
| <!--- Please direct any generic questions related to actions to our support community forum at https://github.com/orgs/community/discussions/categories/actions ---> | ||||
| <!--- Before opening up a new feature request, please make sure to check for similar existing issues and pull requests --> | ||||
| 
 | ||||
| **Description:** | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@actions/cache" | ||||
| version: 4.0.2 | ||||
| version: 4.0.3 | ||||
| type: npm | ||||
| summary: Actions cache lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/cache | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@actions/glob" | ||||
| version: 0.4.0 | ||||
| version: 0.5.0 | ||||
| type: npm | ||||
| summary: Actions glob lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/glob | ||||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@actions/tool-cache" | ||||
| version: 2.0.1 | ||||
| version: 2.0.2 | ||||
| type: npm | ||||
| summary: Actions tool-cache lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: semver | ||||
| version: 7.6.3 | ||||
| version: 7.7.1 | ||||
| type: npm | ||||
| summary: The semantic version parser used by npm. | ||||
| homepage: | ||||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: undici | ||||
| version: 5.28.5 | ||||
| version: 5.29.0 | ||||
| type: npm | ||||
| summary: An HTTP/1.1 client, written from scratch for Node.js | ||||
| homepage: https://undici.nodejs.org | ||||
|  |  | |||
|  | @ -1,39 +0,0 @@ | |||
| --- | ||||
| name: uuid | ||||
| version: 3.4.0 | ||||
| type: npm | ||||
| summary: RFC4122 (v1, v4, and v5) UUIDs | ||||
| homepage: https://github.com/uuidjs/uuid#readme | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
|   text: | | ||||
|     The MIT License (MIT) | ||||
| 
 | ||||
|     Copyright (c) 2010-2016 Robert Kieffer and other contributors | ||||
| 
 | ||||
|     Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|     of this software and associated documentation files (the "Software"), to deal | ||||
|     in the Software without restriction, including without limitation the rights | ||||
|     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|     copies of the Software, and to permit persons to whom the Software is | ||||
|     furnished to do so, subject to the following conditions: | ||||
| 
 | ||||
|     The above copyright notice and this permission notice shall be included in all | ||||
|     copies or substantial portions of the Software. | ||||
| 
 | ||||
|     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
|     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
|     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
|     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
|     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
|     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
|     SOFTWARE. | ||||
| notices: | ||||
| - sources: AUTHORS | ||||
|   text: |- | ||||
|     Robert Kieffer <robert@broofa.com> | ||||
|     Christoph Tavan <dev@tavan.de> | ||||
|     AJ ONeal <coolaj86@gmail.com> | ||||
|     Vincent Voyer <vincent@zeroload.net> | ||||
|     Roman Shtylman <shtylman@gmail.com> | ||||
|  | @ -3,7 +3,7 @@ name: uuid | |||
| version: 8.3.2 | ||||
| type: npm | ||||
| summary: RFC4122 (v1, v4, and v5) UUIDs | ||||
| homepage: https://github.com/uuidjs/uuid#readme | ||||
| homepage: | ||||
| license: mit | ||||
| licenses: | ||||
| - sources: LICENSE.md | ||||
|  | @ -0,0 +1,52 @@ | |||
| import {isSelfHosted} from '../src/utils'; | ||||
| 
 | ||||
| describe('utils', () => { | ||||
|   describe('isSelfHosted', () => { | ||||
|     let AGENT_ISSELFHOSTED: string | undefined; | ||||
|     let RUNNER_ENVIRONMENT: string | undefined; | ||||
| 
 | ||||
|     beforeEach(() => { | ||||
|       AGENT_ISSELFHOSTED = process.env['AGENT_ISSELFHOSTED']; | ||||
|       delete process.env['AGENT_ISSELFHOSTED']; | ||||
|       RUNNER_ENVIRONMENT = process.env['RUNNER_ENVIRONMENT']; | ||||
|       delete process.env['RUNNER_ENVIRONMENT']; | ||||
|     }); | ||||
| 
 | ||||
|     afterEach(() => { | ||||
|       if (AGENT_ISSELFHOSTED === undefined) { | ||||
|         delete process.env['AGENT_ISSELFHOSTED']; | ||||
|       } else { | ||||
|         process.env['AGENT_ISSELFHOSTED'] = AGENT_ISSELFHOSTED; | ||||
|       } | ||||
|       if (RUNNER_ENVIRONMENT === undefined) { | ||||
|         delete process.env['RUNNER_ENVIRONMENT']; | ||||
|       } else { | ||||
|         process.env['RUNNER_ENVIRONMENT'] = RUNNER_ENVIRONMENT; | ||||
|       } | ||||
|     }); | ||||
| 
 | ||||
|     it('isSelfHosted should be true if no environment variables set', () => { | ||||
|       expect(isSelfHosted()).toBeTruthy(); | ||||
|     }); | ||||
| 
 | ||||
|     it('isSelfHosted should be true if environment variable is not set to denote GitHub hosted', () => { | ||||
|       process.env['RUNNER_ENVIRONMENT'] = 'some'; | ||||
|       expect(isSelfHosted()).toBeTruthy(); | ||||
|     }); | ||||
| 
 | ||||
|     it('isSelfHosted should be true if environment variable set to denote Azure Pipelines self hosted', () => { | ||||
|       process.env['AGENT_ISSELFHOSTED'] = '1'; | ||||
|       expect(isSelfHosted()).toBeTruthy(); | ||||
|     }); | ||||
| 
 | ||||
|     it('isSelfHosted should be false if environment variable set to denote GitHub hosted', () => { | ||||
|       process.env['RUNNER_ENVIRONMENT'] = 'github-hosted'; | ||||
|       expect(isSelfHosted()).toBeFalsy(); | ||||
|     }); | ||||
| 
 | ||||
|     it('isSelfHosted should be false if environment variable is not set to denote Azure Pipelines self hosted', () => { | ||||
|       process.env['AGENT_ISSELFHOSTED'] = 'some'; | ||||
|       expect(isSelfHosted()).toBeFalsy(); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
|  | @ -220,7 +220,7 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr | |||
|             }; | ||||
|             const response = yield twirpClient.GetCacheEntryDownloadURL(request); | ||||
|             if (!response.ok) { | ||||
|                 core.debug(`Cache not found for keys: ${keys.join(', ')}`); | ||||
|                 core.debug(`Cache not found for version ${request.version} of keys: ${keys.join(', ')}`); | ||||
|                 return undefined; | ||||
|             } | ||||
|             core.info(`Cache hit for: ${request.key}`); | ||||
|  | @ -2204,6 +2204,7 @@ const cacheUtils_1 = __nccwpck_require__(1518); | |||
| const auth_1 = __nccwpck_require__(5526); | ||||
| const http_client_1 = __nccwpck_require__(6255); | ||||
| const cache_twirp_client_1 = __nccwpck_require__(2655); | ||||
| const util_1 = __nccwpck_require__(1953); | ||||
| /** | ||||
|  * This class is a wrapper around the CacheServiceClientJSON class generated by Twirp. | ||||
|  * | ||||
|  | @ -2263,6 +2264,7 @@ class CacheServiceClient { | |||
|                     (0, core_1.debug)(`[Response] - ${response.message.statusCode}`); | ||||
|                     (0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`); | ||||
|                     const body = JSON.parse(rawBody); | ||||
|                     (0, util_1.maskSecretUrls)(body); | ||||
|                     (0, core_1.debug)(`Body: ${JSON.stringify(body, null, 2)}`); | ||||
|                     if (this.isSuccessStatusCode(statusCode)) { | ||||
|                         return { response, body }; | ||||
|  | @ -2444,6 +2446,87 @@ exports.getUserAgentString = getUserAgentString; | |||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 1953: | ||||
| /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.maskSecretUrls = exports.maskSigUrl = void 0; | ||||
| const core_1 = __nccwpck_require__(2186); | ||||
| /** | ||||
|  * Masks the `sig` parameter in a URL and sets it as a secret. | ||||
|  * | ||||
|  * @param url - The URL containing the signature parameter to mask | ||||
|  * @remarks | ||||
|  * This function attempts to parse the provided URL and identify the 'sig' query parameter. | ||||
|  * If found, it registers both the raw and URL-encoded signature values as secrets using | ||||
|  * the Actions `setSecret` API, which prevents them from being displayed in logs. | ||||
|  * | ||||
|  * The function handles errors gracefully if URL parsing fails, logging them as debug messages. | ||||
|  * | ||||
|  * @example | ||||
|  * ```typescript
 | ||||
|  * // Mask a signature in an Azure SAS token URL
 | ||||
|  * maskSigUrl('https://example.blob.core.windows.net/container/file.txt?sig=abc123&se=2023-01-01'); | ||||
|  * ``` | ||||
|  */ | ||||
| function maskSigUrl(url) { | ||||
|     if (!url) | ||||
|         return; | ||||
|     try { | ||||
|         const parsedUrl = new URL(url); | ||||
|         const signature = parsedUrl.searchParams.get('sig'); | ||||
|         if (signature) { | ||||
|             (0, core_1.setSecret)(signature); | ||||
|             (0, core_1.setSecret)(encodeURIComponent(signature)); | ||||
|         } | ||||
|     } | ||||
|     catch (error) { | ||||
|         (0, core_1.debug)(`Failed to parse URL: ${url} ${error instanceof Error ? error.message : String(error)}`); | ||||
|     } | ||||
| } | ||||
| exports.maskSigUrl = maskSigUrl; | ||||
| /** | ||||
|  * Masks sensitive information in URLs containing signature parameters. | ||||
|  * Currently supports masking 'sig' parameters in the 'signed_upload_url' | ||||
|  * and 'signed_download_url' properties of the provided object. | ||||
|  * | ||||
|  * @param body - The object should contain a signature | ||||
|  * @remarks | ||||
|  * This function extracts URLs from the object properties and calls maskSigUrl | ||||
|  * on each one to redact sensitive signature information. The function doesn't | ||||
|  * modify the original object; it only marks the signatures as secrets for | ||||
|  * logging purposes. | ||||
|  * | ||||
|  * @example | ||||
|  * ```typescript
 | ||||
|  * const responseBody = { | ||||
|  *   signed_upload_url: 'https://blob.core.windows.net/?sig=abc123', | ||||
|  *   signed_download_url: 'https://blob.core/windows.net/?sig=def456' | ||||
|  * }; | ||||
|  * maskSecretUrls(responseBody); | ||||
|  * ``` | ||||
|  */ | ||||
| function maskSecretUrls(body) { | ||||
|     if (typeof body !== 'object' || body === null) { | ||||
|         (0, core_1.debug)('body is not an object or is null'); | ||||
|         return; | ||||
|     } | ||||
|     if ('signed_upload_url' in body && | ||||
|         typeof body.signed_upload_url === 'string') { | ||||
|         maskSigUrl(body.signed_upload_url); | ||||
|     } | ||||
|     if ('signed_download_url' in body && | ||||
|         typeof body.signed_download_url === 'string') { | ||||
|         maskSigUrl(body.signed_download_url); | ||||
|     } | ||||
| } | ||||
| exports.maskSecretUrls = maskSecretUrls; | ||||
| //# sourceMappingURL=util.js.map
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 6490: | ||||
| /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||
| 
 | ||||
|  | @ -62719,7 +62802,7 @@ module.exports = { | |||
| 
 | ||||
| 
 | ||||
| const { parseSetCookie } = __nccwpck_require__(4408) | ||||
| const { stringify, getHeadersList } = __nccwpck_require__(3121) | ||||
| const { stringify } = __nccwpck_require__(3121) | ||||
| const { webidl } = __nccwpck_require__(1744) | ||||
| const { Headers } = __nccwpck_require__(554) | ||||
| 
 | ||||
|  | @ -62795,14 +62878,13 @@ function getSetCookies (headers) { | |||
| 
 | ||||
|   webidl.brandCheck(headers, Headers, { strict: false }) | ||||
| 
 | ||||
|   const cookies = getHeadersList(headers).cookies | ||||
|   const cookies = headers.getSetCookie() | ||||
| 
 | ||||
|   if (!cookies) { | ||||
|     return [] | ||||
|   } | ||||
| 
 | ||||
|   // In older versions of undici, cookies is a list of name:value.
 | ||||
|   return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair)) | ||||
|   return cookies.map((pair) => parseSetCookie(pair)) | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -63230,14 +63312,15 @@ module.exports = { | |||
| /***/ }), | ||||
| 
 | ||||
| /***/ 3121: | ||||
| /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { | ||||
| /***/ ((module) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| 
 | ||||
| const assert = __nccwpck_require__(9491) | ||||
| const { kHeadersList } = __nccwpck_require__(2785) | ||||
| 
 | ||||
| /** | ||||
|  * @param {string} value | ||||
|  * @returns {boolean} | ||||
|  */ | ||||
| function isCTLExcludingHtab (value) { | ||||
|   if (value.length === 0) { | ||||
|     return false | ||||
|  | @ -63498,31 +63581,13 @@ function stringify (cookie) { | |||
|   return out.join('; ') | ||||
| } | ||||
| 
 | ||||
| let kHeadersListNode | ||||
| 
 | ||||
| function getHeadersList (headers) { | ||||
|   if (headers[kHeadersList]) { | ||||
|     return headers[kHeadersList] | ||||
|   } | ||||
| 
 | ||||
|   if (!kHeadersListNode) { | ||||
|     kHeadersListNode = Object.getOwnPropertySymbols(headers).find( | ||||
|       (symbol) => symbol.description === 'headers list' | ||||
|     ) | ||||
| 
 | ||||
|     assert(kHeadersListNode, 'Headers cannot be parsed') | ||||
|   } | ||||
| 
 | ||||
|   const headersList = headers[kHeadersListNode] | ||||
|   assert(headersList) | ||||
| 
 | ||||
|   return headersList | ||||
| } | ||||
| 
 | ||||
| module.exports = { | ||||
|   isCTLExcludingHtab, | ||||
|   stringify, | ||||
|   getHeadersList | ||||
|   validateCookieName, | ||||
|   validateCookiePath, | ||||
|   validateCookieValue, | ||||
|   toIMFDate, | ||||
|   stringify | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -67526,6 +67591,7 @@ const { | |||
|   isValidHeaderName, | ||||
|   isValidHeaderValue | ||||
| } = __nccwpck_require__(2538) | ||||
| const util = __nccwpck_require__(3837) | ||||
| const { webidl } = __nccwpck_require__(1744) | ||||
| const assert = __nccwpck_require__(9491) | ||||
| 
 | ||||
|  | @ -68079,6 +68145,9 @@ Object.defineProperties(Headers.prototype, { | |||
|   [Symbol.toStringTag]: { | ||||
|     value: 'Headers', | ||||
|     configurable: true | ||||
|   }, | ||||
|   [util.inspect.custom]: { | ||||
|     enumerable: false | ||||
|   } | ||||
| }) | ||||
| 
 | ||||
|  | @ -77255,6 +77324,20 @@ class Pool extends PoolBase { | |||
|       ? { ...options.interceptors } | ||||
|       : undefined | ||||
|     this[kFactory] = factory | ||||
| 
 | ||||
|     this.on('connectionError', (origin, targets, error) => { | ||||
|       // If a connection error occurs, we remove the client from the pool,
 | ||||
|       // and emit a connectionError event. They will not be re-used.
 | ||||
|       // Fixes https://github.com/nodejs/undici/issues/3895
 | ||||
|       for (const target of targets) { | ||||
|         // Do not use kRemoveClient here, as it will close the client,
 | ||||
|         // but the client cannot be closed in this state.
 | ||||
|         const idx = this[kClients].indexOf(target) | ||||
|         if (idx !== -1) { | ||||
|           this[kClients].splice(idx, 1) | ||||
|         } | ||||
|       } | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|   [kGetDispatcher] () { | ||||
|  | @ -88674,7 +88757,7 @@ module.exports = parseParams | |||
| /***/ ((module) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.2","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}'); | ||||
| module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.3","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/node":"^22.13.9","@types/semver":"^6.0.0","typescript":"^5.2.2"}}'); | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								package.json
								
								
								
								
							
							
						
						
									
										16
									
								
								package.json
								
								
								
								
							|  | @ -25,31 +25,31 @@ | |||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/cache": "^4.0.2", | ||||
|     "@actions/cache": "^4.0.3", | ||||
|     "@actions/core": "^1.11.1", | ||||
|     "@actions/exec": "^1.1.1", | ||||
|     "@actions/glob": "^0.4.0", | ||||
|     "@actions/glob": "^0.5.0", | ||||
|     "@actions/http-client": "^2.2.1", | ||||
|     "@actions/io": "^1.0.2", | ||||
|     "@actions/tool-cache": "^2.0.1", | ||||
|     "@actions/tool-cache": "^2.0.2", | ||||
|     "semver": "^7.6.3" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^29.5.12", | ||||
|     "@types/jest": "^29.5.14", | ||||
|     "@types/node": "^20.11.28", | ||||
|     "@types/semver": "^7.5.8", | ||||
|     "@typescript-eslint/eslint-plugin": "^5.54.0", | ||||
|     "@typescript-eslint/parser": "^5.54.0", | ||||
|     "@typescript-eslint/eslint-plugin": "^8.31.1", | ||||
|     "@typescript-eslint/parser": "^8.35.1", | ||||
|     "@vercel/ncc": "^0.38.1", | ||||
|     "eslint": "^8.57.0", | ||||
|     "eslint-config-prettier": "^10.0.1", | ||||
|     "eslint-plugin-jest": "^27.9.0", | ||||
|     "eslint-plugin-jest": "^28.11.0", | ||||
|     "eslint-plugin-node": "^11.1.0", | ||||
|     "jest": "^29.7.0", | ||||
|     "jest-circus": "^29.7.0", | ||||
|     "nock": "^10.0.6", | ||||
|     "prettier": "^2.8.4", | ||||
|     "ts-jest": "^29.1.2", | ||||
|     "ts-jest": "^29.3.2", | ||||
|     "typescript": "^5.4.2" | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import * as httpm from '@actions/http-client'; | |||
| import * as sys from './system'; | ||||
| import fs from 'fs'; | ||||
| import os from 'os'; | ||||
| import {StableReleaseAlias} from './utils'; | ||||
| import {StableReleaseAlias, isSelfHosted} from './utils'; | ||||
| 
 | ||||
| const MANIFEST_REPO_OWNER = 'actions'; | ||||
| const MANIFEST_REPO_NAME = 'go-versions'; | ||||
|  | @ -180,11 +180,7 @@ async function cacheWindowsDir( | |||
|   if (os.platform() !== 'win32') return false; | ||||
| 
 | ||||
|   // make sure the action runs in the hosted environment
 | ||||
|   if ( | ||||
|     process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && | ||||
|     process.env['AGENT_ISSELFHOSTED'] === '1' | ||||
|   ) | ||||
|     return false; | ||||
|   if (isSelfHosted()) return false; | ||||
| 
 | ||||
|   const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE']; | ||||
|   if (!defaultToolCacheRoot) return false; | ||||
|  | @ -279,11 +275,46 @@ export async function extractGoArchive(archivePath: string): Promise<string> { | |||
|   return extPath; | ||||
| } | ||||
| 
 | ||||
| function isIToolRelease(obj: any): obj is tc.IToolRelease { | ||||
|   return ( | ||||
|     typeof obj === 'object' && | ||||
|     obj !== null && | ||||
|     typeof obj.version === 'string' && | ||||
|     typeof obj.stable === 'boolean' && | ||||
|     Array.isArray(obj.files) && | ||||
|     obj.files.every( | ||||
|       (file: any) => | ||||
|         typeof file.filename === 'string' && | ||||
|         typeof file.platform === 'string' && | ||||
|         typeof file.arch === 'string' && | ||||
|         typeof file.download_url === 'string' | ||||
|     ) | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| export async function getManifest( | ||||
|   auth: string | undefined | ||||
| ): Promise<tc.IToolRelease[]> { | ||||
|   try { | ||||
|     return await getManifestFromRepo(auth); | ||||
|     const manifest = await getManifestFromRepo(auth); | ||||
|     if ( | ||||
|       Array.isArray(manifest) && | ||||
|       manifest.length && | ||||
|       manifest.every(isIToolRelease) | ||||
|     ) { | ||||
|       return manifest; | ||||
|     } | ||||
| 
 | ||||
|     let errorMessage = | ||||
|       'An unexpected error occurred while fetching the manifest.'; | ||||
|     if ( | ||||
|       typeof manifest === 'object' && | ||||
|       manifest !== null && | ||||
|       'message' in manifest | ||||
|     ) { | ||||
|       errorMessage = (manifest as {message: string}).message; | ||||
|     } | ||||
|     throw new Error(errorMessage); | ||||
|   } catch (err) { | ||||
|     core.debug('Fetching the manifest via the API failed.'); | ||||
|     if (err instanceof Error) { | ||||
|  |  | |||
							
								
								
									
										10
									
								
								src/utils.ts
								
								
								
								
							
							
						
						
									
										10
									
								
								src/utils.ts
								
								
								
								
							|  | @ -2,3 +2,13 @@ export enum StableReleaseAlias { | |||
|   Stable = 'stable', | ||||
|   OldStable = 'oldstable' | ||||
| } | ||||
| 
 | ||||
| export const isSelfHosted = (): boolean => | ||||
|   process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && | ||||
|   (process.env['AGENT_ISSELFHOSTED'] === '1' || | ||||
|     process.env['AGENT_ISSELFHOSTED'] === undefined); | ||||
| /* the above is simplified from: | ||||
|     process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && process.env['AGENT_ISSELFHOSTED'] === '1' | ||||
|     || | ||||
|     process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted' && process.env['AGENT_ISSELFHOSTED'] === undefined | ||||
| */ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 priya-kinthali
						priya-kinthali