mirror of https://github.com/actions/setup-go.git
				
				
				
			Merge branch 'actions:main' into main
This commit is contained in:
		
						commit
						59490e78d8
					
				|  | @ -0,0 +1,20 @@ | |||
| name: 'Publish Immutable Action Version' | ||||
| 
 | ||||
| on: | ||||
|   release: | ||||
|     types: [published] | ||||
| 
 | ||||
| jobs: | ||||
|   publish: | ||||
|     runs-on: ubuntu-latest | ||||
|     permissions: | ||||
|       contents: read | ||||
|       id-token: write | ||||
|       packages: write | ||||
| 
 | ||||
|     steps: | ||||
|       - name: Checking out | ||||
|         uses: actions/checkout@v4 | ||||
|       - name: Publish | ||||
|         id: publish | ||||
|         uses: actions/publish-immutable-action@0.0.3 | ||||
|  | @ -22,7 +22,7 @@ jobs: | |||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Update the ${{ env.TAG_NAME }} tag | ||||
|         uses: actions/publish-action@v0.2.2 | ||||
|         uses: actions/publish-action@v0.3.0 | ||||
|         with: | ||||
|           source-tag: ${{ env.TAG_NAME }} | ||||
|           slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go Stable | ||||
|  | @ -33,7 +33,7 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go oldStable | ||||
|  | @ -48,12 +48,14 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         version: [stable, oldstable] | ||||
|         architecture: [x64, x32] | ||||
|         exclude: | ||||
|           - os: macos-latest | ||||
|             architecture: x32 | ||||
|           - os: macos-13 | ||||
|             architecture: x32 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go ${{ matrix.version }} ${{ matrix.architecture }} | ||||
|  | @ -70,8 +72,14 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.17, 1.18, 1.19] | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.21.13, 1.22.8, 1.23.2] | ||||
|         include: | ||||
|           - os: windows-latest | ||||
|             go: 1.20.14 | ||||
|         exclude: | ||||
|           - os: windows-latest | ||||
|             go: 1.23.2 | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | @ -90,8 +98,8 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         go-version: [1.16, 1.17] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         go-version: ['1.20', '1.21', '1.22', '1.23'] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
|  | @ -107,7 +115,7 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
|  | @ -115,7 +123,7 @@ jobs: | |||
|         with: | ||||
|           go-version-file: __tests__/data/go.mod | ||||
|       - name: verify go | ||||
|         run: __tests__/verify-go.sh 1.14 | ||||
|         run: __tests__/verify-go.sh 1.20.14 | ||||
|         shell: bash | ||||
| 
 | ||||
|   go-version-file-with-gowork: | ||||
|  | @ -123,7 +131,7 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
|  | @ -131,17 +139,16 @@ jobs: | |||
|         with: | ||||
|           go-version-file: __tests__/data/go.work | ||||
|       - name: verify go | ||||
|         run: __tests__/verify-go.sh 1.19 | ||||
|         run: __tests__/verify-go.sh 1.21 | ||||
|         shell: bash | ||||
| 
 | ||||
|   setup-versions-from-manifest: | ||||
|     name: Setup ${{ matrix.go }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.12.16, 1.13.11, 1.14.3] | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.20.14, 1.21.10, 1.22.8, 1.23.2] | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | @ -156,13 +163,12 @@ jobs: | |||
|         shell: bash | ||||
| 
 | ||||
|   setup-versions-from-dist: | ||||
|     name: Setup ${{ matrix.go }} ${{ matrix.os }} | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-latest, windows-latest, ubuntu-latest] | ||||
|         go: [1.9, 1.8.6] | ||||
|         os: [windows-latest, ubuntu-latest, macos-13] | ||||
|         go: [1.11.12] | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v4 | ||||
|  | @ -181,14 +187,23 @@ jobs: | |||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest] | ||||
|         go-version: [1.16, 1.17] | ||||
|         os: [ubuntu-latest, windows-latest, macos-latest, macos-13] | ||||
|         go-version: [1.20.14, 1.21, 1.22, 1.23] | ||||
|         include: | ||||
|           - os: macos-latest | ||||
|             architecture: arm64 | ||||
|           - os: ubuntu-latest | ||||
|             architecture: x64 | ||||
|           - os: windows-latest | ||||
|             architecture: x64 | ||||
|           - os: macos-13 | ||||
|             architecture: x64 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup Go and check latest | ||||
|         uses: ./ | ||||
|         with: | ||||
|           go-version: ${{ matrix.go-version }} | ||||
|           architecture: x64 | ||||
|           architecture: ${{ matrix.architecture }} | ||||
|       - name: Verify Go | ||||
|         run: go version | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@actions/cache" | ||||
| version: 3.2.2 | ||||
| version: 3.2.4 | ||||
| type: npm | ||||
| summary: Actions cache lib | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/cache | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@actions/http-client" | ||||
| version: 2.2.0 | ||||
| version: 2.2.1 | ||||
| type: npm | ||||
| summary: Actions Http Client | ||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/http-client | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: "@types/node" | ||||
| version: 20.10.3 | ||||
| version: 20.11.28 | ||||
| type: npm | ||||
| summary: TypeScript definitions for node | ||||
| homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| --- | ||||
| name: semver | ||||
| version: 7.5.4 | ||||
| version: 7.6.0 | ||||
| type: npm | ||||
| summary: The semantic version parser used by npm. | ||||
| homepage:  | ||||
| homepage: | ||||
| license: isc | ||||
| licenses: | ||||
| - sources: LICENSE | ||||
|  | @ -1,6 +1,6 @@ | |||
| --- | ||||
| name: undici | ||||
| version: 5.28.2 | ||||
| version: 5.28.4 | ||||
| type: npm | ||||
| summary: An HTTP/1.1 client, written from scratch for Node.js | ||||
| homepage: https://undici.nodejs.org | ||||
|  |  | |||
							
								
								
									
										68
									
								
								README.md
								
								
								
								
							
							
						
						
									
										68
									
								
								README.md
								
								
								
								
							|  | @ -8,6 +8,14 @@ This action sets up a go environment for use in actions by: | |||
| - Optionally downloading and caching a version of Go by version and adding to `PATH`. | ||||
| - Registering problem matchers for error output. | ||||
| 
 | ||||
| # V5 | ||||
| 
 | ||||
| The V5 edition of the action offers: | ||||
| 
 | ||||
| - Upgraded Node.js runtime from node16 to node20 | ||||
| 
 | ||||
| See full release notes on the [releases page](https://github.com/actions/setup-go/releases). | ||||
| 
 | ||||
| # V4 | ||||
| 
 | ||||
| The V4 edition of the action offers: | ||||
|  | @ -43,7 +51,7 @@ Matching by [semver spec](https://github.com/npm/node-semver): | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '^1.13.1' # The Go version to download (if necessary) and use. | ||||
|   - run: go version | ||||
|  | @ -52,7 +60,7 @@ steps: | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '>=1.17.0' | ||||
|   - run: go version | ||||
|  | @ -62,15 +70,16 @@ steps: | |||
| > | ||||
| > ```yaml | ||||
| >   go-version: '1.20' | ||||
| >  ``` | ||||
| > ``` | ||||
| > | ||||
| > The recommendation is based on the YAML parser's behavior, which interprets non-wrapped values as numbers and, in the case of version 1.20, trims it down to 1.2, which may not be very obvious. | ||||
| 
 | ||||
| Matching an unstable pre-release: | ||||
| 
 | ||||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '1.18.0-rc.1' # The Go version to download (if necessary) and use. | ||||
|   - run: go version | ||||
|  | @ -79,7 +88,7 @@ steps: | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '1.16.0-beta.1' # The Go version to download (if necessary) and use. | ||||
|   - run: go version | ||||
|  | @ -94,7 +103,7 @@ See [action.yml](action.yml) | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '1.16.1' # The Go version to download (if necessary) and use. | ||||
|   - run: go run hello.go | ||||
|  | @ -115,7 +124,7 @@ want the most up-to-date Go version to always be used. | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '1.14' | ||||
|       check-latest: true | ||||
|  | @ -136,7 +145,7 @@ set to `true` | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: 'stable' | ||||
|   - run: go run hello.go | ||||
|  | @ -145,7 +154,7 @@ steps: | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: 'oldstable' | ||||
|   - run: go run hello.go | ||||
|  | @ -168,7 +177,7 @@ If some problem that prevents success caching happens then the action issues the | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version: '1.17' | ||||
|       check-latest: true | ||||
|  | @ -182,11 +191,13 @@ steps: | |||
| 
 | ||||
| ## Getting go version from the go.mod file | ||||
| 
 | ||||
| The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be | ||||
| used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the | ||||
| latest available patch version sequentially in the runner's directory with the cached tools, in | ||||
| the [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go | ||||
| servers. | ||||
| The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be used by a project. | ||||
| 
 | ||||
| The `go` directive in `go.mod` can specify a patch version or omit it altogether (e.g., `go 1.22.0` or `go 1.22`).   | ||||
| If a patch version is specified, that specific patch version will be used.   | ||||
| If no patch version is specified, it will search for the latest available patch version in the cache, | ||||
| [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json), and the | ||||
| [official Go language website](https://golang.org/dl/?mode=json&include=all), in that order. | ||||
| 
 | ||||
| If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used. | ||||
| > The action will search for the `go.mod` file relative to the repository root | ||||
|  | @ -194,7 +205,7 @@ If both the `go-version` and the `go-version-file` inputs are provided then the | |||
| ```yaml | ||||
| steps: | ||||
|   - uses: actions/checkout@v4 | ||||
|   - uses: actions/setup-go@v4 | ||||
|   - uses: actions/setup-go@v5 | ||||
|     with: | ||||
|       go-version-file: 'path/to/go.mod' | ||||
|   - run: go version | ||||
|  | @ -213,7 +224,7 @@ jobs: | |||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Setup go | ||||
|         uses: actions/setup-go@v4 | ||||
|         uses: actions/setup-go@v5 | ||||
|         with: | ||||
|           go-version: ${{ matrix.go }} | ||||
|       - run: go run hello.go | ||||
|  | @ -231,28 +242,23 @@ documentation. | |||
| 
 | ||||
| ## Using `setup-go` on GHES | ||||
| 
 | ||||
| `setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Go | ||||
| distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions) | ||||
| on github.com (outside of the appliance). These calls to `actions/go-versions` are made via unauthenticated requests, | ||||
| which are limited | ||||
| to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If | ||||
| more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks | ||||
| like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly | ||||
| from https://storage.googleapis.com/golang, but it also can have rate limit so it's better to put token. | ||||
| `setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. | ||||
| When dynamically downloading Go distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions) on github.com (outside of the appliance). | ||||
| 
 | ||||
| To get a higher rate limit, you | ||||
| can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` | ||||
| input for the action: | ||||
| These calls to `actions/go-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). | ||||
| If more requests are made within the time frame, then the action leverages the `raw API` to retrieve the version-manifest. This approach does not impose a rate limit and hence facilitates unrestricted consumption. This is particularly beneficial for GHES runners, which often share the same IP, to avoid the quick exhaustion of the unauthenticated rate limit. | ||||
| If that fails as well the action will try to download versions directly from https://storage.googleapis.com/golang. | ||||
| 
 | ||||
| If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action: | ||||
| 
 | ||||
| ```yaml | ||||
| uses: actions/setup-go@v4 | ||||
| uses: actions/setup-go@v5 | ||||
| with: | ||||
|   token: ${{ secrets.GH_DOTCOM_TOKEN }} | ||||
|   go-version: '1.18' | ||||
| ``` | ||||
| 
 | ||||
| If the runner is not able to access github.com, any Go versions requested during a workflow run must come from the | ||||
| runner's tool cache. | ||||
| If the runner is not able to access github.com, any Go versions requested during a workflow run must come from the runner's tool cache. | ||||
| See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" | ||||
| for more information. | ||||
| 
 | ||||
|  |  | |||
|  | @ -209,3 +209,41 @@ describe('isCacheFeatureAvailable', () => { | |||
|     expect(warningSpy).toHaveBeenCalledWith(warningMessage); | ||||
|   }); | ||||
| }); | ||||
| 
 | ||||
| describe('isGhes', () => { | ||||
|   const pristineEnv = process.env; | ||||
| 
 | ||||
|   beforeEach(() => { | ||||
|     jest.resetModules(); | ||||
|     process.env = {...pristineEnv}; | ||||
|   }); | ||||
| 
 | ||||
|   afterAll(() => { | ||||
|     process.env = pristineEnv; | ||||
|   }); | ||||
| 
 | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => { | ||||
|     delete process.env['GITHUB_SERVER_URL']; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
| 
 | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://github.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
| 
 | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
| 
 | ||||
|   it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost'; | ||||
|     expect(cacheUtils.isGhes()).toBeFalsy(); | ||||
|   }); | ||||
| 
 | ||||
|   it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => { | ||||
|     process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com'; | ||||
|     expect(cacheUtils.isGhes()).toBeTruthy(); | ||||
|   }); | ||||
| }); | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| module example.com/mymodule | ||||
| 
 | ||||
| go 1.14 | ||||
| go 1.20 | ||||
| 
 | ||||
| require ( | ||||
| 	example.com/othermodule v1.2.3 | ||||
|  |  | |||
|  | @ -1,3 +1,3 @@ | |||
| go 1.19 | ||||
| go 1.21 | ||||
| 
 | ||||
| use . | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ import osm, {type} from 'os'; | |||
| import path from 'path'; | ||||
| import * as main from '../src/main'; | ||||
| import * as im from '../src/installer'; | ||||
| import * as httpm from '@actions/http-client'; | ||||
| 
 | ||||
| import goJsonData from './data/golang-dl.json'; | ||||
| import matchers from '../matchers.json'; | ||||
|  | @ -46,6 +47,7 @@ describe('setup-go', () => { | |||
|   let execSpy: jest.SpyInstance; | ||||
|   let getManifestSpy: jest.SpyInstance; | ||||
|   let getAllVersionsSpy: jest.SpyInstance; | ||||
|   let httpmGetJsonSpy: jest.SpyInstance; | ||||
| 
 | ||||
|   beforeAll(async () => { | ||||
|     process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
 | ||||
|  | @ -90,6 +92,9 @@ describe('setup-go', () => { | |||
|     getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo'); | ||||
|     getAllVersionsSpy = jest.spyOn(im, 'getManifest'); | ||||
| 
 | ||||
|     // httm
 | ||||
|     httpmGetJsonSpy = jest.spyOn(httpm.HttpClient.prototype, 'getJson'); | ||||
| 
 | ||||
|     // io
 | ||||
|     whichSpy = jest.spyOn(io, 'which'); | ||||
|     existsSpy = jest.spyOn(fs, 'existsSync'); | ||||
|  | @ -151,6 +156,21 @@ describe('setup-go', () => { | |||
|     ); | ||||
|   }); | ||||
| 
 | ||||
|   it('should return manifest from repo', async () => { | ||||
|     const manifest = await im.getManifest(undefined); | ||||
|     expect(manifest).toEqual(goTestManifest); | ||||
|   }); | ||||
| 
 | ||||
|   it('should return manifest from raw URL if repo fetch fails', async () => { | ||||
|     getManifestSpy.mockRejectedValue(new Error('Fetch failed')); | ||||
|     httpmGetJsonSpy.mockResolvedValue({ | ||||
|       result: goTestManifest | ||||
|     }); | ||||
|     const manifest = await im.getManifest(undefined); | ||||
|     expect(httpmGetJsonSpy).toHaveBeenCalled(); | ||||
|     expect(manifest).toEqual(goTestManifest); | ||||
|   }); | ||||
| 
 | ||||
|   it('can find 1.9 from manifest on linux', async () => { | ||||
|     os.platform = 'linux'; | ||||
|     os.arch = 'x64'; | ||||
|  | @ -790,6 +810,9 @@ describe('setup-go', () => { | |||
|       getManifestSpy.mockImplementation(() => { | ||||
|         throw new Error('Unable to download manifest'); | ||||
|       }); | ||||
|       httpmGetJsonSpy.mockRejectedValue( | ||||
|         new Error('Unable to download manifest from raw URL') | ||||
|       ); | ||||
|       getAllVersionsSpy.mockImplementationOnce(() => undefined); | ||||
| 
 | ||||
|       dlSpy.mockImplementation(async () => '/some/temp/path'); | ||||
|  |  | |||
|  | @ -319,7 +319,8 @@ function createHttpClient() { | |||
|     return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions()); | ||||
| } | ||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||
|     const components = paths; | ||||
|     // don't pass changes upstream
 | ||||
|     const components = paths.slice(); | ||||
|     // Add compression method to cache version to restore
 | ||||
|     // compressed cache as per compression method
 | ||||
|     if (compressionMethod) { | ||||
|  | @ -608,26 +609,21 @@ function resolvePaths(patterns) { | |||
|             implicitDescendants: false | ||||
|         }); | ||||
|         try { | ||||
|             for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a;) { | ||||
|             for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) { | ||||
|                 _c = _g.value; | ||||
|                 _e = false; | ||||
|                 try { | ||||
|                     const file = _c; | ||||
|                     const relativeFile = path | ||||
|                         .relative(workspace, file) | ||||
|                         .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); | ||||
|                     core.debug(`Matched: ${relativeFile}`); | ||||
|                     // Paths are made relative so the tar entries are all relative to the root of the workspace.
 | ||||
|                     if (relativeFile === '') { | ||||
|                         // path.relative returns empty string if workspace and file are equal
 | ||||
|                         paths.push('.'); | ||||
|                     } | ||||
|                     else { | ||||
|                         paths.push(`${relativeFile}`); | ||||
|                     } | ||||
|                 const file = _c; | ||||
|                 const relativeFile = path | ||||
|                     .relative(workspace, file) | ||||
|                     .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); | ||||
|                 core.debug(`Matched: ${relativeFile}`); | ||||
|                 // Paths are made relative so the tar entries are all relative to the root of the workspace.
 | ||||
|                 if (relativeFile === '') { | ||||
|                     // path.relative returns empty string if workspace and file are equal
 | ||||
|                     paths.push('.'); | ||||
|                 } | ||||
|                 finally { | ||||
|                     _e = true; | ||||
|                 else { | ||||
|                     paths.push(`${relativeFile}`); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -711,7 +707,10 @@ function assertDefined(name, value) { | |||
| exports.assertDefined = assertDefined; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGheHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| //# sourceMappingURL=cacheUtils.js.map
 | ||||
|  | @ -729,7 +728,7 @@ var CacheFilename; | |||
| (function (CacheFilename) { | ||||
|     CacheFilename["Gzip"] = "cache.tgz"; | ||||
|     CacheFilename["Zstd"] = "cache.tzst"; | ||||
| })(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {})); | ||||
| })(CacheFilename || (exports.CacheFilename = CacheFilename = {})); | ||||
| var CompressionMethod; | ||||
| (function (CompressionMethod) { | ||||
|     CompressionMethod["Gzip"] = "gzip"; | ||||
|  | @ -737,12 +736,12 @@ var CompressionMethod; | |||
|     // This enum is for earlier version of zstd that does not have --long support
 | ||||
|     CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; | ||||
|     CompressionMethod["Zstd"] = "zstd"; | ||||
| })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); | ||||
| })(CompressionMethod || (exports.CompressionMethod = CompressionMethod = {})); | ||||
| var ArchiveToolType; | ||||
| (function (ArchiveToolType) { | ||||
|     ArchiveToolType["GNU"] = "gnu"; | ||||
|     ArchiveToolType["BSD"] = "bsd"; | ||||
| })(ArchiveToolType = exports.ArchiveToolType || (exports.ArchiveToolType = {})); | ||||
| })(ArchiveToolType || (exports.ArchiveToolType = ArchiveToolType = {})); | ||||
| // The default number of retry attempts.
 | ||||
| exports.DefaultRetryAttempts = 2; | ||||
| // The default delay in milliseconds between retry attempts.
 | ||||
|  | @ -7359,7 +7358,7 @@ class HttpClient { | |||
|         if (this._keepAlive && useProxy) { | ||||
|             agent = this._proxyAgent; | ||||
|         } | ||||
|         if (this._keepAlive && !useProxy) { | ||||
|         if (!useProxy) { | ||||
|             agent = this._agent; | ||||
|         } | ||||
|         // if agent is already assigned use that agent.
 | ||||
|  | @ -7391,16 +7390,12 @@ class HttpClient { | |||
|             agent = tunnelAgent(agentOptions); | ||||
|             this._proxyAgent = agent; | ||||
|         } | ||||
|         // if reusing agent across request and tunneling agent isn't assigned create a new agent
 | ||||
|         if (this._keepAlive && !agent) { | ||||
|         // if tunneling agent isn't assigned create a new agent
 | ||||
|         if (!agent) { | ||||
|             const options = { keepAlive: this._keepAlive, maxSockets }; | ||||
|             agent = usingSsl ? new https.Agent(options) : new http.Agent(options); | ||||
|             this._agent = agent; | ||||
|         } | ||||
|         // if not using private agent and tunnel agent isn't setup then use global agent
 | ||||
|         if (!agent) { | ||||
|             agent = usingSsl ? https.globalAgent : http.globalAgent; | ||||
|         } | ||||
|         if (usingSsl && this._ignoreSslError) { | ||||
|             // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
 | ||||
|             // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
 | ||||
|  | @ -57969,6 +57964,132 @@ function onConnectTimeout (socket) { | |||
| module.exports = buildConnector | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 4462: | ||||
| /***/ ((module) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| 
 | ||||
| /** @type {Record<string, string | undefined>} */ | ||||
| const headerNameLowerCasedRecord = {} | ||||
| 
 | ||||
| // https://developer.mozilla.org/docs/Web/HTTP/Headers
 | ||||
| const wellknownHeaderNames = [ | ||||
|   'Accept', | ||||
|   'Accept-Encoding', | ||||
|   'Accept-Language', | ||||
|   'Accept-Ranges', | ||||
|   'Access-Control-Allow-Credentials', | ||||
|   'Access-Control-Allow-Headers', | ||||
|   'Access-Control-Allow-Methods', | ||||
|   'Access-Control-Allow-Origin', | ||||
|   'Access-Control-Expose-Headers', | ||||
|   'Access-Control-Max-Age', | ||||
|   'Access-Control-Request-Headers', | ||||
|   'Access-Control-Request-Method', | ||||
|   'Age', | ||||
|   'Allow', | ||||
|   'Alt-Svc', | ||||
|   'Alt-Used', | ||||
|   'Authorization', | ||||
|   'Cache-Control', | ||||
|   'Clear-Site-Data', | ||||
|   'Connection', | ||||
|   'Content-Disposition', | ||||
|   'Content-Encoding', | ||||
|   'Content-Language', | ||||
|   'Content-Length', | ||||
|   'Content-Location', | ||||
|   'Content-Range', | ||||
|   'Content-Security-Policy', | ||||
|   'Content-Security-Policy-Report-Only', | ||||
|   'Content-Type', | ||||
|   'Cookie', | ||||
|   'Cross-Origin-Embedder-Policy', | ||||
|   'Cross-Origin-Opener-Policy', | ||||
|   'Cross-Origin-Resource-Policy', | ||||
|   'Date', | ||||
|   'Device-Memory', | ||||
|   'Downlink', | ||||
|   'ECT', | ||||
|   'ETag', | ||||
|   'Expect', | ||||
|   'Expect-CT', | ||||
|   'Expires', | ||||
|   'Forwarded', | ||||
|   'From', | ||||
|   'Host', | ||||
|   'If-Match', | ||||
|   'If-Modified-Since', | ||||
|   'If-None-Match', | ||||
|   'If-Range', | ||||
|   'If-Unmodified-Since', | ||||
|   'Keep-Alive', | ||||
|   'Last-Modified', | ||||
|   'Link', | ||||
|   'Location', | ||||
|   'Max-Forwards', | ||||
|   'Origin', | ||||
|   'Permissions-Policy', | ||||
|   'Pragma', | ||||
|   'Proxy-Authenticate', | ||||
|   'Proxy-Authorization', | ||||
|   'RTT', | ||||
|   'Range', | ||||
|   'Referer', | ||||
|   'Referrer-Policy', | ||||
|   'Refresh', | ||||
|   'Retry-After', | ||||
|   'Sec-WebSocket-Accept', | ||||
|   'Sec-WebSocket-Extensions', | ||||
|   'Sec-WebSocket-Key', | ||||
|   'Sec-WebSocket-Protocol', | ||||
|   'Sec-WebSocket-Version', | ||||
|   'Server', | ||||
|   'Server-Timing', | ||||
|   'Service-Worker-Allowed', | ||||
|   'Service-Worker-Navigation-Preload', | ||||
|   'Set-Cookie', | ||||
|   'SourceMap', | ||||
|   'Strict-Transport-Security', | ||||
|   'Supports-Loading-Mode', | ||||
|   'TE', | ||||
|   'Timing-Allow-Origin', | ||||
|   'Trailer', | ||||
|   'Transfer-Encoding', | ||||
|   'Upgrade', | ||||
|   'Upgrade-Insecure-Requests', | ||||
|   'User-Agent', | ||||
|   'Vary', | ||||
|   'Via', | ||||
|   'WWW-Authenticate', | ||||
|   'X-Content-Type-Options', | ||||
|   'X-DNS-Prefetch-Control', | ||||
|   'X-Frame-Options', | ||||
|   'X-Permitted-Cross-Domain-Policies', | ||||
|   'X-Powered-By', | ||||
|   'X-Requested-With', | ||||
|   'X-XSS-Protection' | ||||
| ] | ||||
| 
 | ||||
| for (let i = 0; i < wellknownHeaderNames.length; ++i) { | ||||
|   const key = wellknownHeaderNames[i] | ||||
|   const lowerCasedKey = key.toLowerCase() | ||||
|   headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = | ||||
|     lowerCasedKey | ||||
| } | ||||
| 
 | ||||
| // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
 | ||||
| Object.setPrototypeOf(headerNameLowerCasedRecord, null) | ||||
| 
 | ||||
| module.exports = { | ||||
|   wellknownHeaderNames, | ||||
|   headerNameLowerCasedRecord | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 8045: | ||||
|  | @ -58801,6 +58922,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045) | |||
| const { Blob } = __nccwpck_require__(4300) | ||||
| const nodeUtil = __nccwpck_require__(3837) | ||||
| const { stringify } = __nccwpck_require__(3477) | ||||
| const { headerNameLowerCasedRecord } = __nccwpck_require__(4462) | ||||
| 
 | ||||
| const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) | ||||
| 
 | ||||
|  | @ -59010,6 +59132,15 @@ function parseKeepAliveTimeout (val) { | |||
|   return m ? parseInt(m[1], 10) * 1000 : null | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Retrieves a header name and returns its lowercase value. | ||||
|  * @param {string | Buffer} value Header name | ||||
|  * @returns {string} | ||||
|  */ | ||||
| function headerNameToString (value) { | ||||
|   return headerNameLowerCasedRecord[value] || value.toLowerCase() | ||||
| } | ||||
| 
 | ||||
| function parseHeaders (headers, obj = {}) { | ||||
|   // For H2 support
 | ||||
|   if (!Array.isArray(headers)) return headers | ||||
|  | @ -59281,6 +59412,7 @@ module.exports = { | |||
|   isIterable, | ||||
|   isAsyncIterable, | ||||
|   isDestroyed, | ||||
|   headerNameToString, | ||||
|   parseRawHeaders, | ||||
|   parseHeaders, | ||||
|   parseKeepAliveTimeout, | ||||
|  | @ -63417,6 +63549,9 @@ function httpRedirectFetch (fetchParams, response) { | |||
|     // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
 | ||||
|     request.headersList.delete('authorization') | ||||
| 
 | ||||
|     // https://fetch.spec.whatwg.org/#authentication-entries
 | ||||
|     request.headersList.delete('proxy-authorization', true) | ||||
| 
 | ||||
|     // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
 | ||||
|     request.headersList.delete('cookie') | ||||
|     request.headersList.delete('host') | ||||
|  | @ -65925,14 +66060,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983 | |||
| const assert = __nccwpck_require__(9491) | ||||
| const { isUint8Array } = __nccwpck_require__(9830) | ||||
| 
 | ||||
| let supportedHashes = [] | ||||
| 
 | ||||
| // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
 | ||||
| /** @type {import('crypto')|undefined} */ | ||||
| let crypto | ||||
| 
 | ||||
| try { | ||||
|   crypto = __nccwpck_require__(6113) | ||||
|   const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] | ||||
|   supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) | ||||
| /* c8 ignore next 3 */ | ||||
| } catch { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| function responseURL (response) { | ||||
|  | @ -66460,66 +66599,56 @@ function bytesMatch (bytes, metadataList) { | |||
|     return true | ||||
|   } | ||||
| 
 | ||||
|   // 3. If parsedMetadata is the empty set, return true.
 | ||||
|   // 3. If response is not eligible for integrity validation, return false.
 | ||||
|   // TODO
 | ||||
| 
 | ||||
|   // 4. If parsedMetadata is the empty set, return true.
 | ||||
|   if (parsedMetadata.length === 0) { | ||||
|     return true | ||||
|   } | ||||
| 
 | ||||
|   // 4. Let metadata be the result of getting the strongest
 | ||||
|   // 5. Let metadata be the result of getting the strongest
 | ||||
|   //    metadata from parsedMetadata.
 | ||||
|   const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) | ||||
|   // get the strongest algorithm
 | ||||
|   const strongest = list[0].algo | ||||
|   // get all entries that use the strongest algorithm; ignore weaker
 | ||||
|   const metadata = list.filter((item) => item.algo === strongest) | ||||
|   const strongest = getStrongestMetadata(parsedMetadata) | ||||
|   const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) | ||||
| 
 | ||||
|   // 5. For each item in metadata:
 | ||||
|   // 6. For each item in metadata:
 | ||||
|   for (const item of metadata) { | ||||
|     // 1. Let algorithm be the alg component of item.
 | ||||
|     const algorithm = item.algo | ||||
| 
 | ||||
|     // 2. Let expectedValue be the val component of item.
 | ||||
|     let expectedValue = item.hash | ||||
|     const expectedValue = item.hash | ||||
| 
 | ||||
|     // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
 | ||||
|     // "be liberal with padding". This is annoying, and it's not even in the spec.
 | ||||
| 
 | ||||
|     if (expectedValue.endsWith('==')) { | ||||
|       expectedValue = expectedValue.slice(0, -2) | ||||
|     } | ||||
| 
 | ||||
|     // 3. Let actualValue be the result of applying algorithm to bytes.
 | ||||
|     let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') | ||||
| 
 | ||||
|     if (actualValue.endsWith('==')) { | ||||
|       actualValue = actualValue.slice(0, -2) | ||||
|     if (actualValue[actualValue.length - 1] === '=') { | ||||
|       if (actualValue[actualValue.length - 2] === '=') { | ||||
|         actualValue = actualValue.slice(0, -2) | ||||
|       } else { | ||||
|         actualValue = actualValue.slice(0, -1) | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     // 4. If actualValue is a case-sensitive match for expectedValue,
 | ||||
|     //    return true.
 | ||||
|     if (actualValue === expectedValue) { | ||||
|       return true | ||||
|     } | ||||
| 
 | ||||
|     let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') | ||||
| 
 | ||||
|     if (actualBase64URL.endsWith('==')) { | ||||
|       actualBase64URL = actualBase64URL.slice(0, -2) | ||||
|     } | ||||
| 
 | ||||
|     if (actualBase64URL === expectedValue) { | ||||
|     if (compareBase64Mixed(actualValue, expectedValue)) { | ||||
|       return true | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 6. Return false.
 | ||||
|   // 7. Return false.
 | ||||
|   return false | ||||
| } | ||||
| 
 | ||||
| // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
 | ||||
| // https://www.w3.org/TR/CSP2/#source-list-syntax
 | ||||
| // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
 | ||||
| const parseHashWithOptions = /((?<algo>sha256|sha384|sha512)-(?<hash>[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i | ||||
| const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i | ||||
| 
 | ||||
| /** | ||||
|  * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
 | ||||
|  | @ -66533,8 +66662,6 @@ function parseMetadata (metadata) { | |||
|   // 2. Let empty be equal to true.
 | ||||
|   let empty = true | ||||
| 
 | ||||
|   const supportedHashes = crypto.getHashes() | ||||
| 
 | ||||
|   // 3. For each token returned by splitting metadata on spaces:
 | ||||
|   for (const token of metadata.split(' ')) { | ||||
|     // 1. Set empty to false.
 | ||||
|  | @ -66544,7 +66671,11 @@ function parseMetadata (metadata) { | |||
|     const parsedToken = parseHashWithOptions.exec(token) | ||||
| 
 | ||||
|     // 3. If token does not parse, continue to the next token.
 | ||||
|     if (parsedToken === null || parsedToken.groups === undefined) { | ||||
|     if ( | ||||
|       parsedToken === null || | ||||
|       parsedToken.groups === undefined || | ||||
|       parsedToken.groups.algo === undefined | ||||
|     ) { | ||||
|       // Note: Chromium blocks the request at this point, but Firefox
 | ||||
|       // gives a warning that an invalid integrity was given. The
 | ||||
|       // correct behavior is to ignore these, and subsequently not
 | ||||
|  | @ -66553,11 +66684,11 @@ function parseMetadata (metadata) { | |||
|     } | ||||
| 
 | ||||
|     // 4. Let algorithm be the hash-algo component of token.
 | ||||
|     const algorithm = parsedToken.groups.algo | ||||
|     const algorithm = parsedToken.groups.algo.toLowerCase() | ||||
| 
 | ||||
|     // 5. If algorithm is a hash function recognized by the user
 | ||||
|     //    agent, add the parsed token to result.
 | ||||
|     if (supportedHashes.includes(algorithm.toLowerCase())) { | ||||
|     if (supportedHashes.includes(algorithm)) { | ||||
|       result.push(parsedToken.groups) | ||||
|     } | ||||
|   } | ||||
|  | @ -66570,6 +66701,82 @@ function parseMetadata (metadata) { | |||
|   return result | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList | ||||
|  */ | ||||
| function getStrongestMetadata (metadataList) { | ||||
|   // Let algorithm be the algo component of the first item in metadataList.
 | ||||
|   // Can be sha256
 | ||||
|   let algorithm = metadataList[0].algo | ||||
|   // If the algorithm is sha512, then it is the strongest
 | ||||
|   // and we can return immediately
 | ||||
|   if (algorithm[3] === '5') { | ||||
|     return algorithm | ||||
|   } | ||||
| 
 | ||||
|   for (let i = 1; i < metadataList.length; ++i) { | ||||
|     const metadata = metadataList[i] | ||||
|     // If the algorithm is sha512, then it is the strongest
 | ||||
|     // and we can break the loop immediately
 | ||||
|     if (metadata.algo[3] === '5') { | ||||
|       algorithm = 'sha512' | ||||
|       break | ||||
|     // If the algorithm is sha384, then a potential sha256 or sha384 is ignored
 | ||||
|     } else if (algorithm[3] === '3') { | ||||
|       continue | ||||
|     // algorithm is sha256, check if algorithm is sha384 and if so, set it as
 | ||||
|     // the strongest
 | ||||
|     } else if (metadata.algo[3] === '3') { | ||||
|       algorithm = 'sha384' | ||||
|     } | ||||
|   } | ||||
|   return algorithm | ||||
| } | ||||
| 
 | ||||
| function filterMetadataListByAlgorithm (metadataList, algorithm) { | ||||
|   if (metadataList.length === 1) { | ||||
|     return metadataList | ||||
|   } | ||||
| 
 | ||||
|   let pos = 0 | ||||
|   for (let i = 0; i < metadataList.length; ++i) { | ||||
|     if (metadataList[i].algo === algorithm) { | ||||
|       metadataList[pos++] = metadataList[i] | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   metadataList.length = pos | ||||
| 
 | ||||
|   return metadataList | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Compares two base64 strings, allowing for base64url | ||||
|  * in the second string. | ||||
|  * | ||||
| * @param {string} actualValue always base64 | ||||
|  * @param {string} expectedValue base64 or base64url | ||||
|  * @returns {boolean} | ||||
|  */ | ||||
| function compareBase64Mixed (actualValue, expectedValue) { | ||||
|   if (actualValue.length !== expectedValue.length) { | ||||
|     return false | ||||
|   } | ||||
|   for (let i = 0; i < actualValue.length; ++i) { | ||||
|     if (actualValue[i] !== expectedValue[i]) { | ||||
|       if ( | ||||
|         (actualValue[i] === '+' && expectedValue[i] === '-') || | ||||
|         (actualValue[i] === '/' && expectedValue[i] === '_') | ||||
|       ) { | ||||
|         continue | ||||
|       } | ||||
|       return false | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return true | ||||
| } | ||||
| 
 | ||||
| // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
 | ||||
| function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { | ||||
|   // TODO
 | ||||
|  | @ -66985,7 +67192,8 @@ module.exports = { | |||
|   urlHasHttpsScheme, | ||||
|   urlIsHttpHttpsScheme, | ||||
|   readAllBytes, | ||||
|   normalizeMethodRecord | ||||
|   normalizeMethodRecord, | ||||
|   parseMetadata | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -69072,12 +69280,17 @@ function parseLocation (statusCode, headers) { | |||
| 
 | ||||
| // https://tools.ietf.org/html/rfc7231#section-6.4.4
 | ||||
| function shouldRemoveHeader (header, removeContent, unknownOrigin) { | ||||
|   return ( | ||||
|     (header.length === 4 && header.toString().toLowerCase() === 'host') || | ||||
|     (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || | ||||
|     (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || | ||||
|     (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') | ||||
|   ) | ||||
|   if (header.length === 4) { | ||||
|     return util.headerNameToString(header) === 'host' | ||||
|   } | ||||
|   if (removeContent && util.headerNameToString(header).startsWith('content-')) { | ||||
|     return true | ||||
|   } | ||||
|   if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { | ||||
|     const name = util.headerNameToString(header) | ||||
|     return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' | ||||
|   } | ||||
|   return false | ||||
| } | ||||
| 
 | ||||
| // https://tools.ietf.org/html/rfc7231#section-6.4
 | ||||
|  | @ -80962,7 +81175,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, | |||
| exports.getCacheDirectoryPath = getCacheDirectoryPath; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|     const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| function isCacheFeatureAvailable() { | ||||
|  |  | |||
|  | @ -319,7 +319,8 @@ function createHttpClient() { | |||
|     return new http_client_1.HttpClient('actions/cache', [bearerCredentialHandler], getRequestOptions()); | ||||
| } | ||||
| function getCacheVersion(paths, compressionMethod, enableCrossOsArchive = false) { | ||||
|     const components = paths; | ||||
|     // don't pass changes upstream
 | ||||
|     const components = paths.slice(); | ||||
|     // Add compression method to cache version to restore
 | ||||
|     // compressed cache as per compression method
 | ||||
|     if (compressionMethod) { | ||||
|  | @ -608,26 +609,21 @@ function resolvePaths(patterns) { | |||
|             implicitDescendants: false | ||||
|         }); | ||||
|         try { | ||||
|             for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a;) { | ||||
|             for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) { | ||||
|                 _c = _g.value; | ||||
|                 _e = false; | ||||
|                 try { | ||||
|                     const file = _c; | ||||
|                     const relativeFile = path | ||||
|                         .relative(workspace, file) | ||||
|                         .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); | ||||
|                     core.debug(`Matched: ${relativeFile}`); | ||||
|                     // Paths are made relative so the tar entries are all relative to the root of the workspace.
 | ||||
|                     if (relativeFile === '') { | ||||
|                         // path.relative returns empty string if workspace and file are equal
 | ||||
|                         paths.push('.'); | ||||
|                     } | ||||
|                     else { | ||||
|                         paths.push(`${relativeFile}`); | ||||
|                     } | ||||
|                 const file = _c; | ||||
|                 const relativeFile = path | ||||
|                     .relative(workspace, file) | ||||
|                     .replace(new RegExp(`\\${path.sep}`, 'g'), '/'); | ||||
|                 core.debug(`Matched: ${relativeFile}`); | ||||
|                 // Paths are made relative so the tar entries are all relative to the root of the workspace.
 | ||||
|                 if (relativeFile === '') { | ||||
|                     // path.relative returns empty string if workspace and file are equal
 | ||||
|                     paths.push('.'); | ||||
|                 } | ||||
|                 finally { | ||||
|                     _e = true; | ||||
|                 else { | ||||
|                     paths.push(`${relativeFile}`); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | @ -711,7 +707,10 @@ function assertDefined(name, value) { | |||
| exports.assertDefined = assertDefined; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGheHost = hostname.endsWith('.GHE.COM') || hostname.endsWith('.GHE.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGheHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| //# sourceMappingURL=cacheUtils.js.map
 | ||||
|  | @ -729,7 +728,7 @@ var CacheFilename; | |||
| (function (CacheFilename) { | ||||
|     CacheFilename["Gzip"] = "cache.tgz"; | ||||
|     CacheFilename["Zstd"] = "cache.tzst"; | ||||
| })(CacheFilename = exports.CacheFilename || (exports.CacheFilename = {})); | ||||
| })(CacheFilename || (exports.CacheFilename = CacheFilename = {})); | ||||
| var CompressionMethod; | ||||
| (function (CompressionMethod) { | ||||
|     CompressionMethod["Gzip"] = "gzip"; | ||||
|  | @ -737,12 +736,12 @@ var CompressionMethod; | |||
|     // This enum is for earlier version of zstd that does not have --long support
 | ||||
|     CompressionMethod["ZstdWithoutLong"] = "zstd-without-long"; | ||||
|     CompressionMethod["Zstd"] = "zstd"; | ||||
| })(CompressionMethod = exports.CompressionMethod || (exports.CompressionMethod = {})); | ||||
| })(CompressionMethod || (exports.CompressionMethod = CompressionMethod = {})); | ||||
| var ArchiveToolType; | ||||
| (function (ArchiveToolType) { | ||||
|     ArchiveToolType["GNU"] = "gnu"; | ||||
|     ArchiveToolType["BSD"] = "bsd"; | ||||
| })(ArchiveToolType = exports.ArchiveToolType || (exports.ArchiveToolType = {})); | ||||
| })(ArchiveToolType || (exports.ArchiveToolType = ArchiveToolType = {})); | ||||
| // The default number of retry attempts.
 | ||||
| exports.DefaultRetryAttempts = 2; | ||||
| // The default delay in milliseconds between retry attempts.
 | ||||
|  | @ -8551,7 +8550,7 @@ class HttpClient { | |||
|         if (this._keepAlive && useProxy) { | ||||
|             agent = this._proxyAgent; | ||||
|         } | ||||
|         if (this._keepAlive && !useProxy) { | ||||
|         if (!useProxy) { | ||||
|             agent = this._agent; | ||||
|         } | ||||
|         // if agent is already assigned use that agent.
 | ||||
|  | @ -8583,16 +8582,12 @@ class HttpClient { | |||
|             agent = tunnelAgent(agentOptions); | ||||
|             this._proxyAgent = agent; | ||||
|         } | ||||
|         // if reusing agent across request and tunneling agent isn't assigned create a new agent
 | ||||
|         if (this._keepAlive && !agent) { | ||||
|         // if tunneling agent isn't assigned create a new agent
 | ||||
|         if (!agent) { | ||||
|             const options = { keepAlive: this._keepAlive, maxSockets }; | ||||
|             agent = usingSsl ? new https.Agent(options) : new http.Agent(options); | ||||
|             this._agent = agent; | ||||
|         } | ||||
|         // if not using private agent and tunnel agent isn't setup then use global agent
 | ||||
|         if (!agent) { | ||||
|             agent = usingSsl ? https.globalAgent : http.globalAgent; | ||||
|         } | ||||
|         if (usingSsl && this._ignoreSslError) { | ||||
|             // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
 | ||||
|             // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
 | ||||
|  | @ -55566,35 +55561,43 @@ const coerce = (version, options) => { | |||
| 
 | ||||
|   let match = null | ||||
|   if (!options.rtl) { | ||||
|     match = version.match(re[t.COERCE]) | ||||
|     match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) | ||||
|   } else { | ||||
|     // Find the right-most coercible string that does not share
 | ||||
|     // a terminus with a more left-ward coercible string.
 | ||||
|     // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
 | ||||
|     // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
 | ||||
|     //
 | ||||
|     // Walk through the string checking with a /g regexp
 | ||||
|     // Manually set the index so as to pick up overlapping matches.
 | ||||
|     // Stop when we get a match that ends at the string end, since no
 | ||||
|     // coercible string can be more right-ward without the same terminus.
 | ||||
|     const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] | ||||
|     let next | ||||
|     while ((next = re[t.COERCERTL].exec(version)) && | ||||
|     while ((next = coerceRtlRegex.exec(version)) && | ||||
|         (!match || match.index + match[0].length !== version.length) | ||||
|     ) { | ||||
|       if (!match || | ||||
|             next.index + next[0].length !== match.index + match[0].length) { | ||||
|         match = next | ||||
|       } | ||||
|       re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length | ||||
|       coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length | ||||
|     } | ||||
|     // leave it in a clean state
 | ||||
|     re[t.COERCERTL].lastIndex = -1 | ||||
|     coerceRtlRegex.lastIndex = -1 | ||||
|   } | ||||
| 
 | ||||
|   if (match === null) { | ||||
|     return null | ||||
|   } | ||||
| 
 | ||||
|   return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) | ||||
|   const major = match[2] | ||||
|   const minor = match[3] || '0' | ||||
|   const patch = match[4] || '0' | ||||
|   const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' | ||||
|   const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' | ||||
| 
 | ||||
|   return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) | ||||
| } | ||||
| module.exports = coerce | ||||
| 
 | ||||
|  | @ -56286,12 +56289,17 @@ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) | |||
| 
 | ||||
| // Coercion.
 | ||||
| // Extract anything that could conceivably be a part of a valid semver
 | ||||
| createToken('COERCE', `${'(^|[^\\d])' + | ||||
| createToken('COERCEPLAIN', `${'(^|[^\\d])' + | ||||
|               '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
 | ||||
|               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + | ||||
|               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + | ||||
|               `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) | ||||
| createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) | ||||
| createToken('COERCEFULL', src[t.COERCEPLAIN] + | ||||
|               `(?:${src[t.PRERELEASE]})?` + | ||||
|               `(?:${src[t.BUILD]})?` + | ||||
|               `(?:$|[^\\d])`) | ||||
| createToken('COERCERTL', src[t.COERCE], true) | ||||
| createToken('COERCERTLFULL', src[t.COERCEFULL], true) | ||||
| 
 | ||||
| // Tilde ranges.
 | ||||
| // Meaning is "reasonably at or greater than"
 | ||||
|  | @ -64974,6 +64982,132 @@ function onConnectTimeout (socket) { | |||
| module.exports = buildConnector | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 4462: | ||||
| /***/ ((module) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| 
 | ||||
| /** @type {Record<string, string | undefined>} */ | ||||
| const headerNameLowerCasedRecord = {} | ||||
| 
 | ||||
| // https://developer.mozilla.org/docs/Web/HTTP/Headers
 | ||||
| const wellknownHeaderNames = [ | ||||
|   'Accept', | ||||
|   'Accept-Encoding', | ||||
|   'Accept-Language', | ||||
|   'Accept-Ranges', | ||||
|   'Access-Control-Allow-Credentials', | ||||
|   'Access-Control-Allow-Headers', | ||||
|   'Access-Control-Allow-Methods', | ||||
|   'Access-Control-Allow-Origin', | ||||
|   'Access-Control-Expose-Headers', | ||||
|   'Access-Control-Max-Age', | ||||
|   'Access-Control-Request-Headers', | ||||
|   'Access-Control-Request-Method', | ||||
|   'Age', | ||||
|   'Allow', | ||||
|   'Alt-Svc', | ||||
|   'Alt-Used', | ||||
|   'Authorization', | ||||
|   'Cache-Control', | ||||
|   'Clear-Site-Data', | ||||
|   'Connection', | ||||
|   'Content-Disposition', | ||||
|   'Content-Encoding', | ||||
|   'Content-Language', | ||||
|   'Content-Length', | ||||
|   'Content-Location', | ||||
|   'Content-Range', | ||||
|   'Content-Security-Policy', | ||||
|   'Content-Security-Policy-Report-Only', | ||||
|   'Content-Type', | ||||
|   'Cookie', | ||||
|   'Cross-Origin-Embedder-Policy', | ||||
|   'Cross-Origin-Opener-Policy', | ||||
|   'Cross-Origin-Resource-Policy', | ||||
|   'Date', | ||||
|   'Device-Memory', | ||||
|   'Downlink', | ||||
|   'ECT', | ||||
|   'ETag', | ||||
|   'Expect', | ||||
|   'Expect-CT', | ||||
|   'Expires', | ||||
|   'Forwarded', | ||||
|   'From', | ||||
|   'Host', | ||||
|   'If-Match', | ||||
|   'If-Modified-Since', | ||||
|   'If-None-Match', | ||||
|   'If-Range', | ||||
|   'If-Unmodified-Since', | ||||
|   'Keep-Alive', | ||||
|   'Last-Modified', | ||||
|   'Link', | ||||
|   'Location', | ||||
|   'Max-Forwards', | ||||
|   'Origin', | ||||
|   'Permissions-Policy', | ||||
|   'Pragma', | ||||
|   'Proxy-Authenticate', | ||||
|   'Proxy-Authorization', | ||||
|   'RTT', | ||||
|   'Range', | ||||
|   'Referer', | ||||
|   'Referrer-Policy', | ||||
|   'Refresh', | ||||
|   'Retry-After', | ||||
|   'Sec-WebSocket-Accept', | ||||
|   'Sec-WebSocket-Extensions', | ||||
|   'Sec-WebSocket-Key', | ||||
|   'Sec-WebSocket-Protocol', | ||||
|   'Sec-WebSocket-Version', | ||||
|   'Server', | ||||
|   'Server-Timing', | ||||
|   'Service-Worker-Allowed', | ||||
|   'Service-Worker-Navigation-Preload', | ||||
|   'Set-Cookie', | ||||
|   'SourceMap', | ||||
|   'Strict-Transport-Security', | ||||
|   'Supports-Loading-Mode', | ||||
|   'TE', | ||||
|   'Timing-Allow-Origin', | ||||
|   'Trailer', | ||||
|   'Transfer-Encoding', | ||||
|   'Upgrade', | ||||
|   'Upgrade-Insecure-Requests', | ||||
|   'User-Agent', | ||||
|   'Vary', | ||||
|   'Via', | ||||
|   'WWW-Authenticate', | ||||
|   'X-Content-Type-Options', | ||||
|   'X-DNS-Prefetch-Control', | ||||
|   'X-Frame-Options', | ||||
|   'X-Permitted-Cross-Domain-Policies', | ||||
|   'X-Powered-By', | ||||
|   'X-Requested-With', | ||||
|   'X-XSS-Protection' | ||||
| ] | ||||
| 
 | ||||
| for (let i = 0; i < wellknownHeaderNames.length; ++i) { | ||||
|   const key = wellknownHeaderNames[i] | ||||
|   const lowerCasedKey = key.toLowerCase() | ||||
|   headerNameLowerCasedRecord[key] = headerNameLowerCasedRecord[lowerCasedKey] = | ||||
|     lowerCasedKey | ||||
| } | ||||
| 
 | ||||
| // Note: object prototypes should not be able to be referenced. e.g. `Object#hasOwnProperty`.
 | ||||
| Object.setPrototypeOf(headerNameLowerCasedRecord, null) | ||||
| 
 | ||||
| module.exports = { | ||||
|   wellknownHeaderNames, | ||||
|   headerNameLowerCasedRecord | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 8045: | ||||
|  | @ -65806,6 +65940,7 @@ const { InvalidArgumentError } = __nccwpck_require__(8045) | |||
| const { Blob } = __nccwpck_require__(4300) | ||||
| const nodeUtil = __nccwpck_require__(3837) | ||||
| const { stringify } = __nccwpck_require__(3477) | ||||
| const { headerNameLowerCasedRecord } = __nccwpck_require__(4462) | ||||
| 
 | ||||
| const [nodeMajor, nodeMinor] = process.versions.node.split('.').map(v => Number(v)) | ||||
| 
 | ||||
|  | @ -66015,6 +66150,15 @@ function parseKeepAliveTimeout (val) { | |||
|   return m ? parseInt(m[1], 10) * 1000 : null | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Retrieves a header name and returns its lowercase value. | ||||
|  * @param {string | Buffer} value Header name | ||||
|  * @returns {string} | ||||
|  */ | ||||
| function headerNameToString (value) { | ||||
|   return headerNameLowerCasedRecord[value] || value.toLowerCase() | ||||
| } | ||||
| 
 | ||||
| function parseHeaders (headers, obj = {}) { | ||||
|   // For H2 support
 | ||||
|   if (!Array.isArray(headers)) return headers | ||||
|  | @ -66286,6 +66430,7 @@ module.exports = { | |||
|   isIterable, | ||||
|   isAsyncIterable, | ||||
|   isDestroyed, | ||||
|   headerNameToString, | ||||
|   parseRawHeaders, | ||||
|   parseHeaders, | ||||
|   parseKeepAliveTimeout, | ||||
|  | @ -70422,6 +70567,9 @@ function httpRedirectFetch (fetchParams, response) { | |||
|     // https://fetch.spec.whatwg.org/#cors-non-wildcard-request-header-name
 | ||||
|     request.headersList.delete('authorization') | ||||
| 
 | ||||
|     // https://fetch.spec.whatwg.org/#authentication-entries
 | ||||
|     request.headersList.delete('proxy-authorization', true) | ||||
| 
 | ||||
|     // "Cookie" and "Host" are forbidden request-headers, which undici doesn't implement.
 | ||||
|     request.headersList.delete('cookie') | ||||
|     request.headersList.delete('host') | ||||
|  | @ -72930,14 +73078,18 @@ const { isBlobLike, toUSVString, ReadableStreamFrom } = __nccwpck_require__(3983 | |||
| const assert = __nccwpck_require__(9491) | ||||
| const { isUint8Array } = __nccwpck_require__(9830) | ||||
| 
 | ||||
| let supportedHashes = [] | ||||
| 
 | ||||
| // https://nodejs.org/api/crypto.html#determining-if-crypto-support-is-unavailable
 | ||||
| /** @type {import('crypto')|undefined} */ | ||||
| let crypto | ||||
| 
 | ||||
| try { | ||||
|   crypto = __nccwpck_require__(6113) | ||||
|   const possibleRelevantHashes = ['sha256', 'sha384', 'sha512'] | ||||
|   supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash)) | ||||
| /* c8 ignore next 3 */ | ||||
| } catch { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| function responseURL (response) { | ||||
|  | @ -73465,66 +73617,56 @@ function bytesMatch (bytes, metadataList) { | |||
|     return true | ||||
|   } | ||||
| 
 | ||||
|   // 3. If parsedMetadata is the empty set, return true.
 | ||||
|   // 3. If response is not eligible for integrity validation, return false.
 | ||||
|   // TODO
 | ||||
| 
 | ||||
|   // 4. If parsedMetadata is the empty set, return true.
 | ||||
|   if (parsedMetadata.length === 0) { | ||||
|     return true | ||||
|   } | ||||
| 
 | ||||
|   // 4. Let metadata be the result of getting the strongest
 | ||||
|   // 5. Let metadata be the result of getting the strongest
 | ||||
|   //    metadata from parsedMetadata.
 | ||||
|   const list = parsedMetadata.sort((c, d) => d.algo.localeCompare(c.algo)) | ||||
|   // get the strongest algorithm
 | ||||
|   const strongest = list[0].algo | ||||
|   // get all entries that use the strongest algorithm; ignore weaker
 | ||||
|   const metadata = list.filter((item) => item.algo === strongest) | ||||
|   const strongest = getStrongestMetadata(parsedMetadata) | ||||
|   const metadata = filterMetadataListByAlgorithm(parsedMetadata, strongest) | ||||
| 
 | ||||
|   // 5. For each item in metadata:
 | ||||
|   // 6. For each item in metadata:
 | ||||
|   for (const item of metadata) { | ||||
|     // 1. Let algorithm be the alg component of item.
 | ||||
|     const algorithm = item.algo | ||||
| 
 | ||||
|     // 2. Let expectedValue be the val component of item.
 | ||||
|     let expectedValue = item.hash | ||||
|     const expectedValue = item.hash | ||||
| 
 | ||||
|     // See https://github.com/web-platform-tests/wpt/commit/e4c5cc7a5e48093220528dfdd1c4012dc3837a0e
 | ||||
|     // "be liberal with padding". This is annoying, and it's not even in the spec.
 | ||||
| 
 | ||||
|     if (expectedValue.endsWith('==')) { | ||||
|       expectedValue = expectedValue.slice(0, -2) | ||||
|     } | ||||
| 
 | ||||
|     // 3. Let actualValue be the result of applying algorithm to bytes.
 | ||||
|     let actualValue = crypto.createHash(algorithm).update(bytes).digest('base64') | ||||
| 
 | ||||
|     if (actualValue.endsWith('==')) { | ||||
|       actualValue = actualValue.slice(0, -2) | ||||
|     if (actualValue[actualValue.length - 1] === '=') { | ||||
|       if (actualValue[actualValue.length - 2] === '=') { | ||||
|         actualValue = actualValue.slice(0, -2) | ||||
|       } else { | ||||
|         actualValue = actualValue.slice(0, -1) | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     // 4. If actualValue is a case-sensitive match for expectedValue,
 | ||||
|     //    return true.
 | ||||
|     if (actualValue === expectedValue) { | ||||
|       return true | ||||
|     } | ||||
| 
 | ||||
|     let actualBase64URL = crypto.createHash(algorithm).update(bytes).digest('base64url') | ||||
| 
 | ||||
|     if (actualBase64URL.endsWith('==')) { | ||||
|       actualBase64URL = actualBase64URL.slice(0, -2) | ||||
|     } | ||||
| 
 | ||||
|     if (actualBase64URL === expectedValue) { | ||||
|     if (compareBase64Mixed(actualValue, expectedValue)) { | ||||
|       return true | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // 6. Return false.
 | ||||
|   // 7. Return false.
 | ||||
|   return false | ||||
| } | ||||
| 
 | ||||
| // https://w3c.github.io/webappsec-subresource-integrity/#grammardef-hash-with-options
 | ||||
| // https://www.w3.org/TR/CSP2/#source-list-syntax
 | ||||
| // https://www.rfc-editor.org/rfc/rfc5234#appendix-B.1
 | ||||
| const parseHashWithOptions = /((?<algo>sha256|sha384|sha512)-(?<hash>[A-z0-9+/]{1}.*={0,2}))( +[\x21-\x7e]?)?/i | ||||
| const parseHashWithOptions = /(?<algo>sha256|sha384|sha512)-((?<hash>[A-Za-z0-9+/]+|[A-Za-z0-9_-]+)={0,2}(?:\s|$)( +[!-~]*)?)?/i | ||||
| 
 | ||||
| /** | ||||
|  * @see https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
 | ||||
|  | @ -73538,8 +73680,6 @@ function parseMetadata (metadata) { | |||
|   // 2. Let empty be equal to true.
 | ||||
|   let empty = true | ||||
| 
 | ||||
|   const supportedHashes = crypto.getHashes() | ||||
| 
 | ||||
|   // 3. For each token returned by splitting metadata on spaces:
 | ||||
|   for (const token of metadata.split(' ')) { | ||||
|     // 1. Set empty to false.
 | ||||
|  | @ -73549,7 +73689,11 @@ function parseMetadata (metadata) { | |||
|     const parsedToken = parseHashWithOptions.exec(token) | ||||
| 
 | ||||
|     // 3. If token does not parse, continue to the next token.
 | ||||
|     if (parsedToken === null || parsedToken.groups === undefined) { | ||||
|     if ( | ||||
|       parsedToken === null || | ||||
|       parsedToken.groups === undefined || | ||||
|       parsedToken.groups.algo === undefined | ||||
|     ) { | ||||
|       // Note: Chromium blocks the request at this point, but Firefox
 | ||||
|       // gives a warning that an invalid integrity was given. The
 | ||||
|       // correct behavior is to ignore these, and subsequently not
 | ||||
|  | @ -73558,11 +73702,11 @@ function parseMetadata (metadata) { | |||
|     } | ||||
| 
 | ||||
|     // 4. Let algorithm be the hash-algo component of token.
 | ||||
|     const algorithm = parsedToken.groups.algo | ||||
|     const algorithm = parsedToken.groups.algo.toLowerCase() | ||||
| 
 | ||||
|     // 5. If algorithm is a hash function recognized by the user
 | ||||
|     //    agent, add the parsed token to result.
 | ||||
|     if (supportedHashes.includes(algorithm.toLowerCase())) { | ||||
|     if (supportedHashes.includes(algorithm)) { | ||||
|       result.push(parsedToken.groups) | ||||
|     } | ||||
|   } | ||||
|  | @ -73575,6 +73719,82 @@ function parseMetadata (metadata) { | |||
|   return result | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * @param {{ algo: 'sha256' | 'sha384' | 'sha512' }[]} metadataList | ||||
|  */ | ||||
| function getStrongestMetadata (metadataList) { | ||||
|   // Let algorithm be the algo component of the first item in metadataList.
 | ||||
|   // Can be sha256
 | ||||
|   let algorithm = metadataList[0].algo | ||||
|   // If the algorithm is sha512, then it is the strongest
 | ||||
|   // and we can return immediately
 | ||||
|   if (algorithm[3] === '5') { | ||||
|     return algorithm | ||||
|   } | ||||
| 
 | ||||
|   for (let i = 1; i < metadataList.length; ++i) { | ||||
|     const metadata = metadataList[i] | ||||
|     // If the algorithm is sha512, then it is the strongest
 | ||||
|     // and we can break the loop immediately
 | ||||
|     if (metadata.algo[3] === '5') { | ||||
|       algorithm = 'sha512' | ||||
|       break | ||||
|     // If the algorithm is sha384, then a potential sha256 or sha384 is ignored
 | ||||
|     } else if (algorithm[3] === '3') { | ||||
|       continue | ||||
|     // algorithm is sha256, check if algorithm is sha384 and if so, set it as
 | ||||
|     // the strongest
 | ||||
|     } else if (metadata.algo[3] === '3') { | ||||
|       algorithm = 'sha384' | ||||
|     } | ||||
|   } | ||||
|   return algorithm | ||||
| } | ||||
| 
 | ||||
| function filterMetadataListByAlgorithm (metadataList, algorithm) { | ||||
|   if (metadataList.length === 1) { | ||||
|     return metadataList | ||||
|   } | ||||
| 
 | ||||
|   let pos = 0 | ||||
|   for (let i = 0; i < metadataList.length; ++i) { | ||||
|     if (metadataList[i].algo === algorithm) { | ||||
|       metadataList[pos++] = metadataList[i] | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   metadataList.length = pos | ||||
| 
 | ||||
|   return metadataList | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * Compares two base64 strings, allowing for base64url | ||||
|  * in the second string. | ||||
|  * | ||||
| * @param {string} actualValue always base64 | ||||
|  * @param {string} expectedValue base64 or base64url | ||||
|  * @returns {boolean} | ||||
|  */ | ||||
| function compareBase64Mixed (actualValue, expectedValue) { | ||||
|   if (actualValue.length !== expectedValue.length) { | ||||
|     return false | ||||
|   } | ||||
|   for (let i = 0; i < actualValue.length; ++i) { | ||||
|     if (actualValue[i] !== expectedValue[i]) { | ||||
|       if ( | ||||
|         (actualValue[i] === '+' && expectedValue[i] === '-') || | ||||
|         (actualValue[i] === '/' && expectedValue[i] === '_') | ||||
|       ) { | ||||
|         continue | ||||
|       } | ||||
|       return false | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return true | ||||
| } | ||||
| 
 | ||||
| // https://w3c.github.io/webappsec-upgrade-insecure-requests/#upgrade-request
 | ||||
| function tryUpgradeRequestToAPotentiallyTrustworthyURL (request) { | ||||
|   // TODO
 | ||||
|  | @ -73990,7 +74210,8 @@ module.exports = { | |||
|   urlHasHttpsScheme, | ||||
|   urlIsHttpHttpsScheme, | ||||
|   readAllBytes, | ||||
|   normalizeMethodRecord | ||||
|   normalizeMethodRecord, | ||||
|   parseMetadata | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -76077,12 +76298,17 @@ function parseLocation (statusCode, headers) { | |||
| 
 | ||||
| // https://tools.ietf.org/html/rfc7231#section-6.4.4
 | ||||
| function shouldRemoveHeader (header, removeContent, unknownOrigin) { | ||||
|   return ( | ||||
|     (header.length === 4 && header.toString().toLowerCase() === 'host') || | ||||
|     (removeContent && header.toString().toLowerCase().indexOf('content-') === 0) || | ||||
|     (unknownOrigin && header.length === 13 && header.toString().toLowerCase() === 'authorization') || | ||||
|     (unknownOrigin && header.length === 6 && header.toString().toLowerCase() === 'cookie') | ||||
|   ) | ||||
|   if (header.length === 4) { | ||||
|     return util.headerNameToString(header) === 'host' | ||||
|   } | ||||
|   if (removeContent && util.headerNameToString(header).startsWith('content-')) { | ||||
|     return true | ||||
|   } | ||||
|   if (unknownOrigin && (header.length === 13 || header.length === 6 || header.length === 19)) { | ||||
|     const name = util.headerNameToString(header) | ||||
|     return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization' | ||||
|   } | ||||
|   return false | ||||
| } | ||||
| 
 | ||||
| // https://tools.ietf.org/html/rfc7231#section-6.4
 | ||||
|  | @ -87819,6 +88045,7 @@ const cache_utils_1 = __nccwpck_require__(1678); | |||
| const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager); | ||||
|     const platform = process.env.RUNNER_OS; | ||||
|     const arch = process.arch; | ||||
|     const cachePaths = yield (0, cache_utils_1.getCacheDirectoryPath)(packageManagerInfo); | ||||
|     const dependencyFilePath = cacheDependencyPath | ||||
|         ? cacheDependencyPath | ||||
|  | @ -87828,7 +88055,7 @@ const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awa | |||
|         throw new Error('Some specified paths were not resolved, unable to cache dependencies.'); | ||||
|     } | ||||
|     const linuxVersion = process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : ''; | ||||
|     const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|     const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|     core.debug(`primary key is ${primaryKey}`); | ||||
|     core.saveState(constants_1.State.CachePrimaryKey, primaryKey); | ||||
|     const cacheKey = yield cache.restoreCache(cachePaths, primaryKey); | ||||
|  | @ -87938,7 +88165,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, | |||
| exports.getCacheDirectoryPath = getCacheDirectoryPath; | ||||
| function isGhes() { | ||||
|     const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); | ||||
|     return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
|     const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|     const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|     const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|     const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
|     return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| exports.isGhes = isGhes; | ||||
| function isCacheFeatureAvailable() { | ||||
|  | @ -88028,9 +88259,13 @@ const sys = __importStar(__nccwpck_require__(5632)); | |||
| const fs_1 = __importDefault(__nccwpck_require__(7147)); | ||||
| const os_1 = __importDefault(__nccwpck_require__(2037)); | ||||
| const utils_1 = __nccwpck_require__(1314); | ||||
| function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) { | ||||
|     var _a; | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
| const MANIFEST_REPO_OWNER = 'actions'; | ||||
| const MANIFEST_REPO_NAME = 'go-versions'; | ||||
| const MANIFEST_REPO_BRANCH = 'main'; | ||||
| const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`; | ||||
| function getGo(versionSpec_1, checkLatest_1, auth_1) { | ||||
|     return __awaiter(this, arguments, void 0, function* (versionSpec, checkLatest, auth, arch = os_1.default.arch()) { | ||||
|         var _a; | ||||
|         let manifest; | ||||
|         const osPlat = os_1.default.platform(); | ||||
|         if (versionSpec === utils_1.StableReleaseAlias.Stable || | ||||
|  | @ -88202,12 +88437,36 @@ function extractGoArchive(archivePath) { | |||
| exports.extractGoArchive = extractGoArchive; | ||||
| function getManifest(auth) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         return tc.getManifestFromRepo('actions', 'go-versions', auth, 'main'); | ||||
|         try { | ||||
|             return yield getManifestFromRepo(auth); | ||||
|         } | ||||
|         catch (err) { | ||||
|             core.debug('Fetching the manifest via the API failed.'); | ||||
|             if (err instanceof Error) { | ||||
|                 core.debug(err.message); | ||||
|             } | ||||
|         } | ||||
|         return yield getManifestFromURL(); | ||||
|     }); | ||||
| } | ||||
| exports.getManifest = getManifest; | ||||
| function getInfoFromManifest(versionSpec, stable, auth, arch = os_1.default.arch(), manifest) { | ||||
| function getManifestFromRepo(auth) { | ||||
|     core.debug(`Getting manifest from ${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}@${MANIFEST_REPO_BRANCH}`); | ||||
|     return tc.getManifestFromRepo(MANIFEST_REPO_OWNER, MANIFEST_REPO_NAME, auth, MANIFEST_REPO_BRANCH); | ||||
| } | ||||
| function getManifestFromURL() { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         core.debug('Falling back to fetching the manifest using raw URL.'); | ||||
|         const http = new httpm.HttpClient('tool-cache'); | ||||
|         const response = yield http.getJson(MANIFEST_URL); | ||||
|         if (!response.result) { | ||||
|             throw new Error(`Unable to get manifest from ${MANIFEST_URL}`); | ||||
|         } | ||||
|         return response.result; | ||||
|     }); | ||||
| } | ||||
| function getInfoFromManifest(versionSpec_1, stable_1, auth_1) { | ||||
|     return __awaiter(this, arguments, void 0, function* (versionSpec, stable, auth, arch = os_1.default.arch(), manifest) { | ||||
|         let info = null; | ||||
|         if (!manifest) { | ||||
|             core.debug('No manifest cached'); | ||||
|  | @ -88241,8 +88500,8 @@ function getInfoFromDist(versionSpec, arch) { | |||
|         }; | ||||
|     }); | ||||
| } | ||||
| function findMatch(versionSpec, arch = os_1.default.arch()) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
| function findMatch(versionSpec_1) { | ||||
|     return __awaiter(this, arguments, void 0, function* (versionSpec, arch = os_1.default.arch()) { | ||||
|         const archFilter = sys.getArch(arch); | ||||
|         const platFilter = sys.getPlatform(); | ||||
|         let result; | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  | @ -113,4 +113,4 @@ Another great way to contribute is pull request reviews. Please, be extra kind: | |||
| - Make sure you're familiar with the code or documentation is updated, unless it's a minor change (spellchecking, minor formatting, etc.) | ||||
| - Review changes using the GitHub functionality. You can ask a clarifying question, point out an error or suggest an alternative.  | ||||
| > Note: You may ask for minor changes - "nitpicks", but consider whether they are real blockers to merging or not | ||||
| - Submit your review, which may include comments, an approval, or a changes request | ||||
| - Submit your review, which may include comments, an approval, or a changes request | ||||
|  |  | |||
|  | @ -9,32 +9,32 @@ | |||
|       "version": "5.0.0", | ||||
|       "license": "MIT", | ||||
|       "dependencies": { | ||||
|         "@actions/cache": "^3.2.1", | ||||
|         "@actions/cache": "^3.2.4", | ||||
|         "@actions/core": "^1.10.0", | ||||
|         "@actions/exec": "^1.1.0", | ||||
|         "@actions/glob": "^0.4.0", | ||||
|         "@actions/http-client": "^2.0.1", | ||||
|         "@actions/http-client": "^2.2.1", | ||||
|         "@actions/io": "^1.0.2", | ||||
|         "@actions/tool-cache": "^2.0.1", | ||||
|         "semver": "^7.5.4" | ||||
|         "semver": "^7.6.0" | ||||
|       }, | ||||
|       "devDependencies": { | ||||
|         "@types/jest": "^29.5.10", | ||||
|         "@types/node": "^20.10.3", | ||||
|         "@types/semver": "^7.5.6", | ||||
|         "@types/jest": "^29.5.12", | ||||
|         "@types/node": "^20.11.28", | ||||
|         "@types/semver": "^7.5.8", | ||||
|         "@typescript-eslint/eslint-plugin": "^5.54.0", | ||||
|         "@typescript-eslint/parser": "^5.54.0", | ||||
|         "@vercel/ncc": "^0.38.1", | ||||
|         "eslint": "^8.35.0", | ||||
|         "eslint": "^8.57.0", | ||||
|         "eslint-config-prettier": "^8.6.0", | ||||
|         "eslint-plugin-jest": "^27.2.1", | ||||
|         "eslint-plugin-jest": "^27.9.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.1", | ||||
|         "typescript": "^5.3.2" | ||||
|         "ts-jest": "^29.1.2", | ||||
|         "typescript": "^5.4.2" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/@aashutoshrathi/word-wrap": { | ||||
|  | @ -47,9 +47,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@actions/cache": { | ||||
|       "version": "3.2.2", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.2.tgz", | ||||
|       "integrity": "sha512-6D0Jq5JrLZRQ3VApeQwQkkV20ZZXjXsHNYXd9VjNUdi9E0h93wESpxfMJ2JWLCUCgHNLcfY0v3GjNM+2FdRMlg==", | ||||
|       "version": "3.2.4", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.4.tgz", | ||||
|       "integrity": "sha512-RuHnwfcDagtX+37s0ZWy7clbOfnZ7AlDJQ7k/9rzt2W4Gnwde3fa/qjSjVuz4vLcLIpc7fUob27CMrqiWZytYA==", | ||||
|       "dependencies": { | ||||
|         "@actions/core": "^1.10.0", | ||||
|         "@actions/exec": "^1.0.1", | ||||
|  | @ -59,7 +59,7 @@ | |||
|         "@azure/abort-controller": "^1.1.0", | ||||
|         "@azure/ms-rest-js": "^2.6.0", | ||||
|         "@azure/storage-blob": "^12.13.0", | ||||
|         "semver": "^6.1.0", | ||||
|         "semver": "^6.3.1", | ||||
|         "uuid": "^3.3.3" | ||||
|       } | ||||
|     }, | ||||
|  | @ -115,9 +115,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@actions/http-client": { | ||||
|       "version": "2.2.0", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", | ||||
|       "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", | ||||
|       "version": "2.2.1", | ||||
|       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.1.tgz", | ||||
|       "integrity": "sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw==", | ||||
|       "dependencies": { | ||||
|         "tunnel": "^0.0.6", | ||||
|         "undici": "^5.25.4" | ||||
|  | @ -1034,9 +1034,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@eslint/js": { | ||||
|       "version": "8.55.0", | ||||
|       "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.55.0.tgz", | ||||
|       "integrity": "sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==", | ||||
|       "version": "8.57.0", | ||||
|       "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", | ||||
|       "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", | ||||
|       "dev": true, | ||||
|       "engines": { | ||||
|         "node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||||
|  | @ -1051,13 +1051,13 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@humanwhocodes/config-array": { | ||||
|       "version": "0.11.13", | ||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", | ||||
|       "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", | ||||
|       "version": "0.11.14", | ||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", | ||||
|       "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@humanwhocodes/object-schema": "^2.0.1", | ||||
|         "debug": "^4.1.1", | ||||
|         "@humanwhocodes/object-schema": "^2.0.2", | ||||
|         "debug": "^4.3.1", | ||||
|         "minimatch": "^3.0.5" | ||||
|       }, | ||||
|       "engines": { | ||||
|  | @ -1078,9 +1078,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@humanwhocodes/object-schema": { | ||||
|       "version": "2.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", | ||||
|       "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", | ||||
|       "version": "2.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", | ||||
|       "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", | ||||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/@istanbuljs/load-nyc-config": { | ||||
|  | @ -1659,9 +1659,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/jest": { | ||||
|       "version": "29.5.10", | ||||
|       "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.10.tgz", | ||||
|       "integrity": "sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==", | ||||
|       "version": "29.5.12", | ||||
|       "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", | ||||
|       "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "expect": "^29.0.0", | ||||
|  | @ -1675,9 +1675,9 @@ | |||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/@types/node": { | ||||
|       "version": "20.10.3", | ||||
|       "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.3.tgz", | ||||
|       "integrity": "sha512-XJavIpZqiXID5Yxnxv3RUDKTN5b81ddNC3ecsA0SoFXz/QU8OGBwZGMomiq0zw+uuqbL/krztv/DINAQ/EV4gg==", | ||||
|       "version": "20.11.28", | ||||
|       "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.28.tgz", | ||||
|       "integrity": "sha512-M/GPWVS2wLkSkNHVeLkrF2fD5Lx5UC4PxA0uZcKc6QqbIQUJyW1jVjueJYi1z8n0I5PxYrtpnPnWglE+y9A0KA==", | ||||
|       "dependencies": { | ||||
|         "undici-types": "~5.26.4" | ||||
|       } | ||||
|  | @ -1705,9 +1705,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/@types/semver": { | ||||
|       "version": "7.5.6", | ||||
|       "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", | ||||
|       "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", | ||||
|       "version": "7.5.8", | ||||
|       "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", | ||||
|       "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", | ||||
|       "dev": true | ||||
|     }, | ||||
|     "node_modules/@types/stack-utils": { | ||||
|  | @ -2214,12 +2214,12 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/braces": { | ||||
|       "version": "3.0.2", | ||||
|       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", | ||||
|       "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", | ||||
|       "version": "3.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", | ||||
|       "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "fill-range": "^7.0.1" | ||||
|         "fill-range": "^7.1.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": ">=8" | ||||
|  | @ -2504,10 +2504,11 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/cross-spawn": { | ||||
|       "version": "7.0.3", | ||||
|       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", | ||||
|       "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", | ||||
|       "version": "7.0.6", | ||||
|       "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", | ||||
|       "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", | ||||
|       "dev": true, | ||||
|       "license": "MIT", | ||||
|       "dependencies": { | ||||
|         "path-key": "^3.1.0", | ||||
|         "shebang-command": "^2.0.0", | ||||
|  | @ -2731,16 +2732,16 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/eslint": { | ||||
|       "version": "8.55.0", | ||||
|       "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.55.0.tgz", | ||||
|       "integrity": "sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==", | ||||
|       "version": "8.57.0", | ||||
|       "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", | ||||
|       "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@eslint-community/eslint-utils": "^4.2.0", | ||||
|         "@eslint-community/regexpp": "^4.6.1", | ||||
|         "@eslint/eslintrc": "^2.1.4", | ||||
|         "@eslint/js": "8.55.0", | ||||
|         "@humanwhocodes/config-array": "^0.11.13", | ||||
|         "@eslint/js": "8.57.0", | ||||
|         "@humanwhocodes/config-array": "^0.11.14", | ||||
|         "@humanwhocodes/module-importer": "^1.0.1", | ||||
|         "@nodelib/fs.walk": "^1.2.8", | ||||
|         "@ungap/structured-clone": "^1.2.0", | ||||
|  | @ -2817,9 +2818,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/eslint-plugin-jest": { | ||||
|       "version": "27.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.6.0.tgz", | ||||
|       "integrity": "sha512-MTlusnnDMChbElsszJvrwD1dN3x6nZl//s4JD23BxB6MgR66TZlL064su24xEIS3VACfAoHV1vgyMgPw8nkdng==", | ||||
|       "version": "27.9.0", | ||||
|       "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", | ||||
|       "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "@typescript-eslint/utils": "^5.10.0" | ||||
|  | @ -2828,7 +2829,7 @@ | |||
|         "node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", | ||||
|         "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", | ||||
|         "eslint": "^7.0.0 || ^8.0.0", | ||||
|         "jest": "*" | ||||
|       }, | ||||
|  | @ -3175,9 +3176,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/fill-range": { | ||||
|       "version": "7.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", | ||||
|       "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", | ||||
|       "version": "7.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", | ||||
|       "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "to-regex-range": "^5.0.1" | ||||
|  | @ -4559,12 +4560,12 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/micromatch": { | ||||
|       "version": "4.0.5", | ||||
|       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", | ||||
|       "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", | ||||
|       "version": "4.0.8", | ||||
|       "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", | ||||
|       "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "braces": "^3.0.2", | ||||
|         "braces": "^3.0.3", | ||||
|         "picomatch": "^2.3.1" | ||||
|       }, | ||||
|       "engines": { | ||||
|  | @ -5310,9 +5311,9 @@ | |||
|       "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" | ||||
|     }, | ||||
|     "node_modules/semver": { | ||||
|       "version": "7.5.4", | ||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", | ||||
|       "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", | ||||
|       "version": "7.6.0", | ||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", | ||||
|       "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", | ||||
|       "dependencies": { | ||||
|         "lru-cache": "^6.0.0" | ||||
|       }, | ||||
|  | @ -5616,9 +5617,9 @@ | |||
|       "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" | ||||
|     }, | ||||
|     "node_modules/ts-jest": { | ||||
|       "version": "29.1.1", | ||||
|       "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", | ||||
|       "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", | ||||
|       "version": "29.1.2", | ||||
|       "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", | ||||
|       "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", | ||||
|       "dev": true, | ||||
|       "dependencies": { | ||||
|         "bs-logger": "0.x", | ||||
|  | @ -5634,7 +5635,7 @@ | |||
|         "ts-jest": "cli.js" | ||||
|       }, | ||||
|       "engines": { | ||||
|         "node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||||
|         "node": "^16.10.0 || ^18.0.0 || >=20.0.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "@babel/core": ">=7.0.0-beta.0 <8", | ||||
|  | @ -5726,9 +5727,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/typescript": { | ||||
|       "version": "5.3.2", | ||||
|       "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz", | ||||
|       "integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==", | ||||
|       "version": "5.4.2", | ||||
|       "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", | ||||
|       "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", | ||||
|       "dev": true, | ||||
|       "bin": { | ||||
|         "tsc": "bin/tsc", | ||||
|  | @ -5739,9 +5740,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/undici": { | ||||
|       "version": "5.28.2", | ||||
|       "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz", | ||||
|       "integrity": "sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==", | ||||
|       "version": "5.28.4", | ||||
|       "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", | ||||
|       "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", | ||||
|       "dependencies": { | ||||
|         "@fastify/busboy": "^2.0.0" | ||||
|       }, | ||||
|  |  | |||
							
								
								
									
										20
									
								
								package.json
								
								
								
								
							
							
						
						
									
										20
									
								
								package.json
								
								
								
								
							|  | @ -25,31 +25,31 @@ | |||
|   "author": "GitHub", | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "@actions/cache": "^3.2.1", | ||||
|     "@actions/cache": "^3.2.4", | ||||
|     "@actions/core": "^1.10.0", | ||||
|     "@actions/exec": "^1.1.0", | ||||
|     "@actions/glob": "^0.4.0", | ||||
|     "@actions/http-client": "^2.0.1", | ||||
|     "@actions/http-client": "^2.2.1", | ||||
|     "@actions/io": "^1.0.2", | ||||
|     "@actions/tool-cache": "^2.0.1", | ||||
|     "semver": "^7.5.4" | ||||
|     "semver": "^7.6.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@types/jest": "^29.5.10", | ||||
|     "@types/node": "^20.10.3", | ||||
|     "@types/semver": "^7.5.6", | ||||
|     "@types/jest": "^29.5.12", | ||||
|     "@types/node": "^20.11.28", | ||||
|     "@types/semver": "^7.5.8", | ||||
|     "@typescript-eslint/eslint-plugin": "^5.54.0", | ||||
|     "@typescript-eslint/parser": "^5.54.0", | ||||
|     "@vercel/ncc": "^0.38.1", | ||||
|     "eslint": "^8.35.0", | ||||
|     "eslint": "^8.57.0", | ||||
|     "eslint-config-prettier": "^8.6.0", | ||||
|     "eslint-plugin-jest": "^27.2.1", | ||||
|     "eslint-plugin-jest": "^27.9.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.1", | ||||
|     "typescript": "^5.3.2" | ||||
|     "ts-jest": "^29.1.2", | ||||
|     "typescript": "^5.4.2" | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ export const restoreCache = async ( | |||
| ) => { | ||||
|   const packageManagerInfo = await getPackageManagerInfo(packageManager); | ||||
|   const platform = process.env.RUNNER_OS; | ||||
|   const arch = process.arch; | ||||
| 
 | ||||
|   const cachePaths = await getCacheDirectoryPath(packageManagerInfo); | ||||
| 
 | ||||
|  | @ -31,7 +32,7 @@ export const restoreCache = async ( | |||
| 
 | ||||
|   const linuxVersion = | ||||
|     process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : ''; | ||||
|   const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|   const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`; | ||||
|   core.debug(`primary key is ${primaryKey}`); | ||||
| 
 | ||||
|   core.saveState(State.CachePrimaryKey, primaryKey); | ||||
|  |  | |||
|  | @ -63,7 +63,13 @@ export function isGhes(): boolean { | |||
|   const ghUrl = new URL( | ||||
|     process.env['GITHUB_SERVER_URL'] || 'https://github.com' | ||||
|   ); | ||||
|   return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
| 
 | ||||
|   const hostname = ghUrl.hostname.trimEnd().toUpperCase(); | ||||
|   const isGitHubHost = hostname === 'GITHUB.COM'; | ||||
|   const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM'); | ||||
|   const isLocalHost = hostname.endsWith('.LOCALHOST'); | ||||
| 
 | ||||
|   return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost; | ||||
| } | ||||
| 
 | ||||
| export function isCacheFeatureAvailable(): boolean { | ||||
|  |  | |||
|  | @ -8,6 +8,11 @@ import fs from 'fs'; | |||
| import os from 'os'; | ||||
| import {StableReleaseAlias} from './utils'; | ||||
| 
 | ||||
| const MANIFEST_REPO_OWNER = 'actions'; | ||||
| const MANIFEST_REPO_NAME = 'go-versions'; | ||||
| const MANIFEST_REPO_BRANCH = 'main'; | ||||
| const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`; | ||||
| 
 | ||||
| type InstallationType = 'dist' | 'manifest'; | ||||
| 
 | ||||
| export interface IGoVersionFile { | ||||
|  | @ -274,8 +279,43 @@ export async function extractGoArchive(archivePath: string): Promise<string> { | |||
|   return extPath; | ||||
| } | ||||
| 
 | ||||
| export async function getManifest(auth: string | undefined) { | ||||
|   return tc.getManifestFromRepo('actions', 'go-versions', auth, 'main'); | ||||
| export async function getManifest( | ||||
|   auth: string | undefined | ||||
| ): Promise<tc.IToolRelease[]> { | ||||
|   try { | ||||
|     return await getManifestFromRepo(auth); | ||||
|   } catch (err) { | ||||
|     core.debug('Fetching the manifest via the API failed.'); | ||||
|     if (err instanceof Error) { | ||||
|       core.debug(err.message); | ||||
|     } | ||||
|   } | ||||
|   return await getManifestFromURL(); | ||||
| } | ||||
| 
 | ||||
| function getManifestFromRepo( | ||||
|   auth: string | undefined | ||||
| ): Promise<tc.IToolRelease[]> { | ||||
|   core.debug( | ||||
|     `Getting manifest from ${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}@${MANIFEST_REPO_BRANCH}` | ||||
|   ); | ||||
|   return tc.getManifestFromRepo( | ||||
|     MANIFEST_REPO_OWNER, | ||||
|     MANIFEST_REPO_NAME, | ||||
|     auth, | ||||
|     MANIFEST_REPO_BRANCH | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| async function getManifestFromURL(): Promise<tc.IToolRelease[]> { | ||||
|   core.debug('Falling back to fetching the manifest using raw URL.'); | ||||
| 
 | ||||
|   const http: httpm.HttpClient = new httpm.HttpClient('tool-cache'); | ||||
|   const response = await http.getJson<tc.IToolRelease[]>(MANIFEST_URL); | ||||
|   if (!response.result) { | ||||
|     throw new Error(`Unable to get manifest from ${MANIFEST_URL}`); | ||||
|   } | ||||
|   return response.result; | ||||
| } | ||||
| 
 | ||||
| export async function getInfoFromManifest( | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 priya-kinthali
						priya-kinthali