mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-29 15:52:42 +08:00 
			
		
		
		
	Compare commits
	
		
			48 Commits
		
	
	
		
			v3.2.0
			...
			tiwarishub
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					d4989cba2f | ||
| 
						 | 
					c59451a53b | ||
| 
						 | 
					e7cd373485 | ||
| 
						 | 
					59088c2a15 | ||
| 
						 | 
					09ba51f18e | ||
| 
						 | 
					b3ca1ac971 | ||
| 
						 | 
					78faa555e1 | ||
| 
						 | 
					0f15a51ed6 | ||
| 
						 | 
					460f88643a | ||
| 
						 | 
					d8b0944270 | ||
| 
						 | 
					0ad06209dd | ||
| 
						 | 
					adeb189fd8 | ||
| 
						 | 
					0d7418813c | ||
| 
						 | 
					3ac35dad40 | ||
| 
						 | 
					7d610f0c26 | ||
| 
						 | 
					bcb9f31327 | ||
| 
						 | 
					73ea510762 | ||
| 
						 | 
					eaead3517c | ||
| 
						 | 
					24301fe9fb | ||
| 
						 | 
					63d5b78043 | ||
| 
						 | 
					2ad69f7464 | ||
| 
						 | 
					847eaae378 | ||
| 
						 | 
					db3ddb5ef4 | ||
| 
						 | 
					9185654d72 | ||
| 
						 | 
					60b802d0e8 | ||
| 
						 | 
					2b1e32b119 | ||
| 
						 | 
					60ad0741c0 | ||
| 
						 | 
					11c7f932ce | ||
| 
						 | 
					f1702f8f38 | ||
| 
						 | 
					1196f2ae1b | ||
| 
						 | 
					c22fc3c628 | ||
| 
						 | 
					cdcc53e14f | ||
| 
						 | 
					b287e177c9 | ||
| 
						 | 
					eeb10cff27 | ||
| 
						 | 
					ed1a46e9f2 | ||
| 
						 | 
					daff393d43 | ||
| 
						 | 
					b14573ddb9 | ||
| 
						 | 
					7569de03e7 | ||
| 
						 | 
					b20a2561b9 | ||
| 
						 | 
					ea3459bb45 | ||
| 
						 | 
					141334fcd1 | ||
| 
						 | 
					808c8f917f | ||
| 
						 | 
					fd1b409bc3 | ||
| 
						 | 
					9a03ebd9cc | ||
| 
						 | 
					45e544a71a | ||
| 
						 | 
					8c66f89aef | ||
| 
						 | 
					3601f2a33e | ||
| 
						 | 
					4d62fafc05 | 
							
								
								
									
										10
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							@@ -35,13 +35,21 @@ jobs:
 | 
				
			|||||||
      fail-fast: false
 | 
					      fail-fast: false
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
					        os: [ubuntu-latest, windows-latest, macos-latest]
 | 
				
			||||||
        node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*]
 | 
					        node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
      - name: Setup Node
 | 
					      - name: Setup Node
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          node-version: ${{ matrix.node-version }}
 | 
					          node-version: ${{ matrix.node-version }}
 | 
				
			||||||
 | 
					          check-latest: true
 | 
				
			||||||
 | 
					      - if: runner.os != 'Windows'
 | 
				
			||||||
 | 
					        name: Verify node and npm
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          . "$NVM_DIR/nvm.sh"
 | 
				
			||||||
 | 
					          [[ $(nvm version-remote "${{ matrix.node-version }}") =~ ^v([^.]+) ]]
 | 
				
			||||||
 | 
					          __tests__/verify-node.sh "${BASH_REMATCH[1]}"
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  manifest:
 | 
					  manifest:
 | 
				
			||||||
    runs-on: ${{ matrix.os }}
 | 
					    runs-on: ${{ matrix.os }}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
name: "@actions/cache"
 | 
					name: "@actions/cache"
 | 
				
			||||||
version: 2.0.2
 | 
					version: 3.0.0
 | 
				
			||||||
type: npm
 | 
					type: npm
 | 
				
			||||||
summary: Actions cache lib
 | 
					summary: Actions cache lib
 | 
				
			||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
 | 
					homepage: https://github.com/actions/toolkit/tree/main/packages/cache
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								.licenses/npm/@actions/http-client-2.0.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								.licenses/npm/@actions/http-client-2.0.1.dep.yml
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					name: "@actions/http-client"
 | 
				
			||||||
 | 
					version: 2.0.1
 | 
				
			||||||
 | 
					type: npm
 | 
				
			||||||
 | 
					summary: Actions Http Client
 | 
				
			||||||
 | 
					homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
 | 
				
			||||||
 | 
					license: mit
 | 
				
			||||||
 | 
					licenses:
 | 
				
			||||||
 | 
					- sources: LICENSE
 | 
				
			||||||
 | 
					  text: |
 | 
				
			||||||
 | 
					    Actions Http Client for Node.js
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Copyright (c) GitHub, Inc.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    All rights reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    MIT License
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 | 
				
			||||||
 | 
					    associated documentation files (the "Software"), to deal in the Software without restriction,
 | 
				
			||||||
 | 
					    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
				
			||||||
 | 
					    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
 | 
				
			||||||
 | 
					    subject to the following conditions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 | 
				
			||||||
 | 
					    LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 | 
				
			||||||
 | 
					    NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 | 
				
			||||||
 | 
					    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 | 
				
			||||||
 | 
					    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
				
			||||||
 | 
					notices: []
 | 
				
			||||||
							
								
								
									
										28
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								README.md
									
									
									
									
									
								
							@@ -22,7 +22,7 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: 14
 | 
					    node-version: 16
 | 
				
			||||||
- run: npm ci
 | 
					- run: npm ci
 | 
				
			||||||
- run: npm test
 | 
					- run: npm test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -35,14 +35,20 @@ For information regarding locally cached versions of Node.js on GitHub hosted ru
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Supported version syntax
 | 
					### Supported version syntax
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The `node-version` input supports the following syntax:
 | 
					The `node-version` input supports the Semantic Versioning Specification, for more detailed examples please refer to the [documentation](https://github.com/npm/node-semver).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
major versions: `12`, `14`, `16`
 | 
					Examples:
 | 
				
			||||||
more specific versions: `10.15`, `14.2.0`, `16.3.0`
 | 
					 | 
				
			||||||
nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*`
 | 
					 | 
				
			||||||
latest release: `latest`/`current`/`node`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Note:** Since the latest release will not be cached always, there is possibility of hitting rate limit when downloading from dist
 | 
					 - Major versions: `14`, `16`, `18`
 | 
				
			||||||
 | 
					 - More specific versions: `10.15`, `16.15.1` , `18.4.0`
 | 
				
			||||||
 | 
					 - NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n`
 | 
				
			||||||
 | 
					 - Latest release: `*` or `latest`/`current`/`node`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json).
 | 
				
			||||||
 | 
					That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not.
 | 
				
			||||||
 | 
					Since it will not be cached always, there is possibility of hitting rate limit when downloading from dist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Checking in lockfiles
 | 
					### Checking in lockfiles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,7 +58,7 @@ It's **always** recommended to commit the lockfile of your package manager for s
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default.
 | 
					The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional, and caching is turned off by default.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The action defaults to search for the dependency file (`package-lock.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
 | 
					The action defaults to search for the dependency file (`package-lock.json`, `npm-shrinkwrap.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Note:** The action does not cache `node_modules`
 | 
					**Note:** The action does not cache `node_modules`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,7 +71,7 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: 14
 | 
					    node-version: 16
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
- run: npm ci
 | 
					- run: npm ci
 | 
				
			||||||
- run: npm test
 | 
					- run: npm test
 | 
				
			||||||
@@ -78,7 +84,7 @@ steps:
 | 
				
			|||||||
- uses: actions/checkout@v3
 | 
					- uses: actions/checkout@v3
 | 
				
			||||||
- uses: actions/setup-node@v3
 | 
					- uses: actions/setup-node@v3
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: 14
 | 
					    node-version: 16
 | 
				
			||||||
    cache: 'npm'
 | 
					    cache: 'npm'
 | 
				
			||||||
    cache-dependency-path: subdir/package-lock.json
 | 
					    cache-dependency-path: subdir/package-lock.json
 | 
				
			||||||
- run: npm ci
 | 
					- run: npm ci
 | 
				
			||||||
@@ -93,7 +99,7 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        node: [ 12, 14, 16 ]
 | 
					        node: [ 14, 16, 18 ]
 | 
				
			||||||
    name: Node ${{ matrix.node }} sample
 | 
					    name: Node ${{ matrix.node }} sample
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,6 +294,63 @@ describe('run', () => {
 | 
				
			|||||||
      );
 | 
					      );
 | 
				
			||||||
      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
					      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it('save with -1 cacheId, should not fail workflow', async () => {
 | 
				
			||||||
 | 
					      inputs['cache'] = 'npm';
 | 
				
			||||||
 | 
					      getStateSpy.mockImplementation((name: string) => {
 | 
				
			||||||
 | 
					        if (name === State.CacheMatchedKey) {
 | 
				
			||||||
 | 
					          return npmFileHash;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          return yarnFileHash;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`);
 | 
				
			||||||
 | 
					      saveCacheSpy.mockImplementation(() => {
 | 
				
			||||||
 | 
					        return -1;
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      await run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      expect(getInputSpy).toHaveBeenCalled();
 | 
				
			||||||
 | 
					      expect(getStateSpy).toHaveBeenCalledTimes(2);
 | 
				
			||||||
 | 
					      expect(getCommandOutputSpy).toHaveBeenCalledTimes(1);
 | 
				
			||||||
 | 
					      expect(debugSpy).toHaveBeenCalledWith(`npm path is ${commonPath}/npm`);
 | 
				
			||||||
 | 
					      expect(infoSpy).not.toHaveBeenCalledWith(
 | 
				
			||||||
 | 
					        `Cache hit occurred on the primary key ${npmFileHash}, not saving cache.`
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					      expect(saveCacheSpy).toHaveBeenCalled();
 | 
				
			||||||
 | 
					      expect(infoSpy).not.toHaveBeenLastCalledWith(
 | 
				
			||||||
 | 
					        `Cache saved with the key: ${yarnFileHash}`
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					      expect(setFailedSpy).not.toHaveBeenCalled();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it('saves with error from toolkit, should fail workflow', async () => {
 | 
				
			||||||
 | 
					      inputs['cache'] = 'npm';
 | 
				
			||||||
 | 
					      getStateSpy.mockImplementation((name: string) => {
 | 
				
			||||||
 | 
					        if (name === State.CacheMatchedKey) {
 | 
				
			||||||
 | 
					          return npmFileHash;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          return yarnFileHash;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`);
 | 
				
			||||||
 | 
					      saveCacheSpy.mockImplementation(() => {
 | 
				
			||||||
 | 
					        throw new cache.ValidationError('Validation failed');
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      await run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      expect(getInputSpy).toHaveBeenCalled();
 | 
				
			||||||
 | 
					      expect(getStateSpy).toHaveBeenCalledTimes(2);
 | 
				
			||||||
 | 
					      expect(getCommandOutputSpy).toHaveBeenCalledTimes(1);
 | 
				
			||||||
 | 
					      expect(debugSpy).toHaveBeenCalledWith(`npm path is ${commonPath}/npm`);
 | 
				
			||||||
 | 
					      expect(infoSpy).not.toHaveBeenCalledWith(
 | 
				
			||||||
 | 
					        `Cache hit occurred on the primary key ${npmFileHash}, not saving cache.`
 | 
				
			||||||
 | 
					      );
 | 
				
			||||||
 | 
					      expect(saveCacheSpy).toHaveBeenCalled();
 | 
				
			||||||
 | 
					      expect(setFailedSpy).toHaveBeenCalled();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(() => {
 | 
					  afterEach(() => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,50 +3,50 @@
 | 
				
			|||||||
    "version": "14.0.0",
 | 
					    "version": "14.0.0",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
    "lts": "Fermium",
 | 
					    "lts": "Fermium",
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200423.30",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200507.99",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-14.0.0-darwin-x64.tar.gz",
 | 
					        "filename": "node-14.0.0-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-14.0.0-linux-x64.tar.gz",
 | 
					        "filename": "node-14.0.0-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-14.0.0-win32-x64.zip",
 | 
					        "filename": "node-14.0.0-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    "version": "13.13.0",
 | 
					    "version": "13.13.0",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200423.29",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200507.97",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-13.13.0-darwin-x64.tar.gz",
 | 
					        "filename": "node-13.13.0-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200507.97/node-13.13.0-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-13.13.0-linux-x64.tar.gz",
 | 
					        "filename": "node-13.13.0-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200507.97/node-13.13.0-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-13.13.0-win32-x64.zip",
 | 
					        "filename": "node-13.13.0-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200507.97/node-13.13.0-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -54,25 +54,51 @@
 | 
				
			|||||||
    "version": "12.16.2",
 | 
					    "version": "12.16.2",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
    "lts": "Erbium",
 | 
					    "lts": "Erbium",
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200423.28",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200507.95",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-12.16.2-darwin-x64.tar.gz",
 | 
					        "filename": "node-12.16.2-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-12.16.2-linux-x64.tar.gz",
 | 
					        "filename": "node-12.16.2-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-12.16.2-win32-x64.zip",
 | 
					        "filename": "node-12.16.2-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-win32-x64.7z"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    "version": "12.0.0",
 | 
				
			||||||
 | 
					    "stable": true,
 | 
				
			||||||
 | 
					    "lts": "Erbium",
 | 
				
			||||||
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/12.0.0-20200507.71",
 | 
				
			||||||
 | 
					    "files": [
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "filename": "node-12.0.0-darwin-x64.tar.gz",
 | 
				
			||||||
 | 
					        "arch": "x64",
 | 
				
			||||||
 | 
					        "platform": "darwin",
 | 
				
			||||||
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-darwin-x64.tar.gz"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "filename": "node-12.0.0-linux-x64.tar.gz",
 | 
				
			||||||
 | 
					        "arch": "x64",
 | 
				
			||||||
 | 
					        "platform": "linux",
 | 
				
			||||||
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-linux-x64.tar.gz"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "filename": "node-12.0.0-win32-x64.7z",
 | 
				
			||||||
 | 
					        "arch": "x64",
 | 
				
			||||||
 | 
					        "platform": "win32",
 | 
				
			||||||
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/12.0.0-20200507.71/node-12.0.0-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -80,25 +106,25 @@
 | 
				
			|||||||
    "version": "10.20.1",
 | 
					    "version": "10.20.1",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
    "lts": "Dubnium",
 | 
					    "lts": "Dubnium",
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200423.27",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200507.70",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-10.20.1-darwin-x64.tar.gz",
 | 
					        "filename": "node-10.20.1-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200507.70/node-10.20.1-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-10.20.1-linux-x64.tar.gz",
 | 
					        "filename": "node-10.20.1-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200507.70/node-10.20.1-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-10.20.1-win32-x64.zip",
 | 
					        "filename": "node-10.20.1-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200507.70/node-10.20.1-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -106,25 +132,25 @@
 | 
				
			|||||||
    "version": "8.17.0",
 | 
					    "version": "8.17.0",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
    "lts": "Carbon",
 | 
					    "lts": "Carbon",
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200423.26",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200507.37",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-8.17.0-darwin-x64.tar.gz",
 | 
					        "filename": "node-8.17.0-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200507.37/node-8.17.0-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-8.17.0-linux-x64.tar.gz",
 | 
					        "filename": "node-8.17.0-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200507.37/node-8.17.0-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-8.17.0-win32-x64.zip",
 | 
					        "filename": "node-8.17.0-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200507.37/node-8.17.0-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
@@ -132,26 +158,26 @@
 | 
				
			|||||||
    "version": "6.17.1",
 | 
					    "version": "6.17.1",
 | 
				
			||||||
    "stable": true,
 | 
					    "stable": true,
 | 
				
			||||||
    "lts": "Boron",
 | 
					    "lts": "Boron",
 | 
				
			||||||
      "release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200423.25",
 | 
					    "release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200529.2",
 | 
				
			||||||
    "files": [
 | 
					    "files": [
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-6.17.1-darwin-x64.tar.gz",
 | 
					        "filename": "node-6.17.1-darwin-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "darwin",
 | 
					        "platform": "darwin",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-darwin-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200529.2/node-6.17.1-darwin-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        "filename": "node-6.17.1-linux-x64.tar.gz",
 | 
					        "filename": "node-6.17.1-linux-x64.tar.gz",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "linux",
 | 
					        "platform": "linux",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-linux-x64.tar.gz"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200529.2/node-6.17.1-linux-x64.tar.gz"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
          "filename": "node-6.17.1-win32-x64.zip",
 | 
					        "filename": "node-6.17.1-win32-x64.7z",
 | 
				
			||||||
        "arch": "x64",
 | 
					        "arch": "x64",
 | 
				
			||||||
        "platform": "win32",
 | 
					        "platform": "win32",
 | 
				
			||||||
          "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-win32-x64.zip"
 | 
					        "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200529.2/node-6.17.1-win32-x64.7z"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  ]
 | 
					]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
import * as io from '@actions/io';
 | 
					import * as io from '@actions/io';
 | 
				
			||||||
import * as tc from '@actions/tool-cache';
 | 
					import * as tc from '@actions/tool-cache';
 | 
				
			||||||
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
import * as im from '../src/installer';
 | 
					import * as im from '../src/installer';
 | 
				
			||||||
import * as cache from '@actions/cache';
 | 
					import * as cache from '@actions/cache';
 | 
				
			||||||
import fs from 'fs';
 | 
					import fs from 'fs';
 | 
				
			||||||
@@ -38,6 +39,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
  let authSpy: jest.SpyInstance;
 | 
					  let authSpy: jest.SpyInstance;
 | 
				
			||||||
  let parseNodeVersionSpy: jest.SpyInstance;
 | 
					  let parseNodeVersionSpy: jest.SpyInstance;
 | 
				
			||||||
  let isCacheActionAvailable: jest.SpyInstance;
 | 
					  let isCacheActionAvailable: jest.SpyInstance;
 | 
				
			||||||
 | 
					  let getExecOutputSpy: jest.SpyInstance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
    // @actions/core
 | 
					    // @actions/core
 | 
				
			||||||
@@ -103,6 +105,10 @@ describe('setup-node', () => {
 | 
				
			|||||||
      // uncomment to debug
 | 
					      // uncomment to debug
 | 
				
			||||||
      // process.stderr.write('log:' + line + '\n');
 | 
					      // process.stderr.write('log:' + line + '\n');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // @actions/exec
 | 
				
			||||||
 | 
					    getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
 | 
				
			||||||
 | 
					    getExecOutputSpy.mockImplementation(() => 'v16.15.0');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(() => {
 | 
					  afterEach(() => {
 | 
				
			||||||
@@ -126,7 +132,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
      'mocktoken'
 | 
					      'mocktoken'
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
    expect(versions).toBeDefined();
 | 
					    expect(versions).toBeDefined();
 | 
				
			||||||
    expect(versions?.length).toBe(6);
 | 
					    expect(versions?.length).toBe(7);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('can mock dist versions', async () => {
 | 
					  it('can mock dist versions', async () => {
 | 
				
			||||||
@@ -135,8 +141,15 @@ describe('setup-node', () => {
 | 
				
			|||||||
    expect(versions?.length).toBe(23);
 | 
					    expect(versions?.length).toBe(23);
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it('can find 12.16.2 from manifest on osx', async () => {
 | 
					  it.each([
 | 
				
			||||||
    os.platform = 'darwin';
 | 
					    ['12.16.2', 'darwin', '12.16.2', 'Erbium'],
 | 
				
			||||||
 | 
					    ['12', 'linux', '12.16.2', 'Erbium'],
 | 
				
			||||||
 | 
					    ['10', 'win32', '10.20.1', 'Dubnium'],
 | 
				
			||||||
 | 
					    ['*', 'linux', '14.0.0', 'Fermium']
 | 
				
			||||||
 | 
					  ])(
 | 
				
			||||||
 | 
					    'can find %s from manifest on %s',
 | 
				
			||||||
 | 
					    async (versionSpec, platform, expectedVersion, expectedLts) => {
 | 
				
			||||||
 | 
					      os.platform = platform;
 | 
				
			||||||
      os.arch = 'x64';
 | 
					      os.arch = 'x64';
 | 
				
			||||||
      let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
 | 
					      let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
 | 
				
			||||||
        'actions',
 | 
					        'actions',
 | 
				
			||||||
@@ -144,41 +157,12 @@ describe('setup-node', () => {
 | 
				
			|||||||
        'mocktoken'
 | 
					        'mocktoken'
 | 
				
			||||||
      );
 | 
					      );
 | 
				
			||||||
      expect(versions).toBeDefined();
 | 
					      expect(versions).toBeDefined();
 | 
				
			||||||
    let match = await tc.findFromManifest('12.16.2', true, versions);
 | 
					      let match = await tc.findFromManifest(versionSpec, true, versions);
 | 
				
			||||||
      expect(match).toBeDefined();
 | 
					      expect(match).toBeDefined();
 | 
				
			||||||
    expect(match?.version).toBe('12.16.2');
 | 
					      expect(match?.version).toBe(expectedVersion);
 | 
				
			||||||
    expect((match as any).lts).toBe('Erbium');
 | 
					      expect((match as any).lts).toBe(expectedLts);
 | 
				
			||||||
  });
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  it('can find 12 from manifest on linux', async () => {
 | 
					 | 
				
			||||||
    os.platform = 'linux';
 | 
					 | 
				
			||||||
    os.arch = 'x64';
 | 
					 | 
				
			||||||
    let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
 | 
					 | 
				
			||||||
      'actions',
 | 
					 | 
				
			||||||
      'node-versions',
 | 
					 | 
				
			||||||
      'mocktoken'
 | 
					 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
    expect(versions).toBeDefined();
 | 
					 | 
				
			||||||
    let match = await tc.findFromManifest('12.16.2', true, versions);
 | 
					 | 
				
			||||||
    expect(match).toBeDefined();
 | 
					 | 
				
			||||||
    expect(match?.version).toBe('12.16.2');
 | 
					 | 
				
			||||||
    expect((match as any).lts).toBe('Erbium');
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  it('can find 10 from manifest on windows', async () => {
 | 
					 | 
				
			||||||
    os.platform = 'win32';
 | 
					 | 
				
			||||||
    os.arch = 'x64';
 | 
					 | 
				
			||||||
    let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo(
 | 
					 | 
				
			||||||
      'actions',
 | 
					 | 
				
			||||||
      'node-versions',
 | 
					 | 
				
			||||||
      'mocktoken'
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
    expect(versions).toBeDefined();
 | 
					 | 
				
			||||||
    let match = await tc.findFromManifest('10', true, versions);
 | 
					 | 
				
			||||||
    expect(match).toBeDefined();
 | 
					 | 
				
			||||||
    expect(match?.version).toBe('10.20.1');
 | 
					 | 
				
			||||||
    expect((match as any).lts).toBe('Dubnium');
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //--------------------------------------------------
 | 
					  //--------------------------------------------------
 | 
				
			||||||
  // Found in cache tests
 | 
					  // Found in cache tests
 | 
				
			||||||
@@ -250,7 +234,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
    inputs['token'] = 'faketoken';
 | 
					    inputs['token'] = 'faketoken';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let expectedUrl =
 | 
					    let expectedUrl =
 | 
				
			||||||
      'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
 | 
					      'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // ... but not in the local cache
 | 
					    // ... but not in the local cache
 | 
				
			||||||
    findSpy.mockImplementation(() => '');
 | 
					    findSpy.mockImplementation(() => '');
 | 
				
			||||||
@@ -288,7 +272,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
    inputs['token'] = 'faketoken';
 | 
					    inputs['token'] = 'faketoken';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let expectedUrl =
 | 
					    let expectedUrl =
 | 
				
			||||||
      'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
 | 
					      'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // ... but not in the local cache
 | 
					    // ... but not in the local cache
 | 
				
			||||||
    findSpy.mockImplementation(() => '');
 | 
					    findSpy.mockImplementation(() => '');
 | 
				
			||||||
@@ -457,7 +441,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
      exSpy.mockImplementation(async () => '/some/other/temp/path');
 | 
					      exSpy.mockImplementation(async () => '/some/other/temp/path');
 | 
				
			||||||
      cacheSpy.mockImplementation(async () => toolPath);
 | 
					      cacheSpy.mockImplementation(async () => toolPath);
 | 
				
			||||||
      const expectedUrl =
 | 
					      const expectedUrl =
 | 
				
			||||||
        'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
 | 
					        'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      await main.run();
 | 
					      await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -699,11 +683,17 @@ describe('setup-node', () => {
 | 
				
			|||||||
      inputs.stable = 'true';
 | 
					      inputs.stable = 'true';
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('find latest LTS version and resolve it from local cache (lts/erbium)', async () => {
 | 
					    it.each([
 | 
				
			||||||
 | 
					      ['erbium', '12.16.2'],
 | 
				
			||||||
 | 
					      ['*', '14.0.0'],
 | 
				
			||||||
 | 
					      ['-1', '12.16.2']
 | 
				
			||||||
 | 
					    ])(
 | 
				
			||||||
 | 
					      'find latest LTS version and resolve it from local cache (lts/%s)',
 | 
				
			||||||
 | 
					      async (lts, expectedVersion) => {
 | 
				
			||||||
        // arrange
 | 
					        // arrange
 | 
				
			||||||
      inputs['node-version'] = 'lts/erbium';
 | 
					        inputs['node-version'] = `lts/${lts}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const toolPath = path.normalize('/cache/node/12.16.2/x64');
 | 
					        const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
 | 
				
			||||||
        findSpy.mockReturnValue(toolPath);
 | 
					        findSpy.mockReturnValue(toolPath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // act
 | 
					        // act
 | 
				
			||||||
@@ -718,28 +708,46 @@ describe('setup-node', () => {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
					        expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
				
			||||||
        expect(dbgSpy).toHaveBeenCalledWith(
 | 
					        expect(dbgSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `LTS alias 'erbium' for Node version 'lts/erbium'`
 | 
					          `LTS alias '${lts}' for Node version 'lts/${lts}'`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(dbgSpy).toHaveBeenCalledWith(
 | 
					        expect(dbgSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `Found LTS release '12.16.2' for Node version 'lts/erbium'`
 | 
					          `Found LTS release '${expectedVersion}' for Node version 'lts/${lts}'`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
 | 
					        expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
 | 
				
			||||||
        expect(cnSpy).toHaveBeenCalledWith(
 | 
					        expect(cnSpy).toHaveBeenCalledWith(
 | 
				
			||||||
          `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
					          `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    });
 | 
					      }
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('find latest LTS version and install it from manifest (lts/erbium)', async () => {
 | 
					    it.each([
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        'erbium',
 | 
				
			||||||
 | 
					        '12.16.2',
 | 
				
			||||||
 | 
					        'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        '*',
 | 
				
			||||||
 | 
					        '14.0.0',
 | 
				
			||||||
 | 
					        'https://github.com/actions/node-versions/releases/download/14.0.0-20200507.99/node-14.0.0-linux-x64.tar.gz'
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        '-1',
 | 
				
			||||||
 | 
					        '12.16.2',
 | 
				
			||||||
 | 
					        'https://github.com/actions/node-versions/releases/download/12.16.2-20200507.95/node-12.16.2-linux-x64.tar.gz'
 | 
				
			||||||
 | 
					      ]
 | 
				
			||||||
 | 
					    ])(
 | 
				
			||||||
 | 
					      'find latest LTS version and install it from manifest (lts/%s)',
 | 
				
			||||||
 | 
					      async (lts, expectedVersion, expectedUrl) => {
 | 
				
			||||||
        // arrange
 | 
					        // arrange
 | 
				
			||||||
      inputs['node-version'] = 'lts/erbium';
 | 
					        inputs['node-version'] = `lts/${lts}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const toolPath = path.normalize('/cache/node/12.16.2/x64');
 | 
					        const toolPath = path.normalize(`/cache/node/${expectedVersion}/x64`);
 | 
				
			||||||
        findSpy.mockImplementation(() => '');
 | 
					        findSpy.mockImplementation(() => '');
 | 
				
			||||||
        dlSpy.mockImplementation(async () => '/some/temp/path');
 | 
					        dlSpy.mockImplementation(async () => '/some/temp/path');
 | 
				
			||||||
        exSpy.mockImplementation(async () => '/some/other/temp/path');
 | 
					        exSpy.mockImplementation(async () => '/some/other/temp/path');
 | 
				
			||||||
        cacheSpy.mockImplementation(async () => toolPath);
 | 
					        cacheSpy.mockImplementation(async () => toolPath);
 | 
				
			||||||
      const expectedUrl =
 | 
					        const expectedMajor = expectedVersion.split('.')[0];
 | 
				
			||||||
        'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // act
 | 
					        // act
 | 
				
			||||||
        await main.run();
 | 
					        await main.run();
 | 
				
			||||||
@@ -753,91 +761,24 @@ describe('setup-node', () => {
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
					        expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
				
			||||||
        expect(dbgSpy).toHaveBeenCalledWith(
 | 
					        expect(dbgSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `LTS alias 'erbium' for Node version 'lts/erbium'`
 | 
					          `LTS alias '${lts}' for Node version 'lts/${lts}'`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(dbgSpy).toHaveBeenCalledWith(
 | 
					        expect(dbgSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `Found LTS release '12.16.2' for Node version 'lts/erbium'`
 | 
					          `Found LTS release '${expectedVersion}' for Node version 'lts/${lts}'`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith('Attempting to download 12...');
 | 
					 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith(
 | 
					        expect(logSpy).toHaveBeenCalledWith(
 | 
				
			||||||
        `Acquiring 12.16.2 - ${os.arch} from ${expectedUrl}`
 | 
					          `Attempting to download ${expectedMajor}...`
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        expect(logSpy).toHaveBeenCalledWith(
 | 
				
			||||||
 | 
					          `Acquiring ${expectedVersion} - ${os.arch} from ${expectedUrl}`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith('Extracting ...');
 | 
					        expect(logSpy).toHaveBeenCalledWith('Extracting ...');
 | 
				
			||||||
        expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
 | 
					        expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
 | 
				
			||||||
        expect(cnSpy).toHaveBeenCalledWith(
 | 
					        expect(cnSpy).toHaveBeenCalledWith(
 | 
				
			||||||
          `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
					          `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
    });
 | 
					      }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('find latest LTS version and resolve it from local cache (lts/*)', async () => {
 | 
					 | 
				
			||||||
      // arrange
 | 
					 | 
				
			||||||
      inputs['node-version'] = 'lts/*';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      const toolPath = path.normalize('/cache/node/14.0.0/x64');
 | 
					 | 
				
			||||||
      findSpy.mockReturnValue(toolPath);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // act
 | 
					 | 
				
			||||||
      await main.run();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // assert
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        'Attempt to resolve LTS alias from manifest...'
 | 
					 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        'Getting manifest from actions/node-versions@main'
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
					 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `LTS alias '*' for Node version 'lts/*'`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `Found LTS release '14.0.0' for Node version 'lts/*'`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
 | 
					 | 
				
			||||||
      expect(cnSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    it('find latest LTS version and install it from manifest (lts/*)', async () => {
 | 
					 | 
				
			||||||
      // arrange
 | 
					 | 
				
			||||||
      inputs['node-version'] = 'lts/*';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      const toolPath = path.normalize('/cache/node/14.0.0/x64');
 | 
					 | 
				
			||||||
      findSpy.mockImplementation(() => '');
 | 
					 | 
				
			||||||
      dlSpy.mockImplementation(async () => '/some/temp/path');
 | 
					 | 
				
			||||||
      exSpy.mockImplementation(async () => '/some/other/temp/path');
 | 
					 | 
				
			||||||
      cacheSpy.mockImplementation(async () => toolPath);
 | 
					 | 
				
			||||||
      const expectedUrl =
 | 
					 | 
				
			||||||
        'https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // act
 | 
					 | 
				
			||||||
      await main.run();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // assert
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        'Attempt to resolve LTS alias from manifest...'
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        'Getting manifest from actions/node-versions@main'
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(dbgSpy).not.toHaveBeenCalledWith('No manifest cached');
 | 
					 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `LTS alias '*' for Node version 'lts/*'`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(dbgSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `Found LTS release '14.0.0' for Node version 'lts/*'`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith('Attempting to download 14...');
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `Acquiring 14.0.0 - ${os.arch} from ${expectedUrl}`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith('Extracting ...');
 | 
					 | 
				
			||||||
      expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...');
 | 
					 | 
				
			||||||
      expect(cnSpy).toHaveBeenCalledWith(
 | 
					 | 
				
			||||||
        `::add-path::${path.join(toolPath, 'bin')}${osm.EOL}`
 | 
					 | 
				
			||||||
      );
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it('fail with unable to parse LTS alias (lts/)', async () => {
 | 
					    it('fail with unable to parse LTS alias (lts/)', async () => {
 | 
				
			||||||
      // arrange
 | 
					      // arrange
 | 
				
			||||||
@@ -935,4 +876,31 @@ describe('setup-node', () => {
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  describe('latest alias syntax from cache', () => {
 | 
				
			||||||
 | 
					    it.each(['latest', 'current', 'node'])(
 | 
				
			||||||
 | 
					      'download the %s version if alias is provided',
 | 
				
			||||||
 | 
					      async inputVersion => {
 | 
				
			||||||
 | 
					        // Arrange
 | 
				
			||||||
 | 
					        inputs['node-version'] = inputVersion;
 | 
				
			||||||
 | 
					        const expectedVersion = nodeTestDist[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        os.platform = 'darwin';
 | 
				
			||||||
 | 
					        os.arch = 'x64';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const toolPath = path.normalize(
 | 
				
			||||||
 | 
					          `/cache/node/${expectedVersion.version}/x64`
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        findSpy.mockReturnValue(toolPath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Act
 | 
				
			||||||
 | 
					        await main.run();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // assert
 | 
				
			||||||
 | 
					        expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(logSpy).toHaveBeenCalledWith('getting latest node version...');
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,8 @@ inputs:
 | 
				
			|||||||
outputs:
 | 
					outputs:
 | 
				
			||||||
  cache-hit: 
 | 
					  cache-hit: 
 | 
				
			||||||
    description: 'A boolean value to indicate if a cache was hit.'
 | 
					    description: 'A boolean value to indicate if a cache was hit.'
 | 
				
			||||||
 | 
					  node-version:
 | 
				
			||||||
 | 
					    description: 'The installed node version.'
 | 
				
			||||||
runs:
 | 
					runs:
 | 
				
			||||||
  using: 'node16'
 | 
					  using: 'node16'
 | 
				
			||||||
  main: 'dist/setup/index.js'
 | 
					  main: 'dist/setup/index.js'
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										55734
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										55734
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										76824
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76824
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -19,12 +19,13 @@ Ensure that `package-lock.json` is always committed, use `npm ci` instead of `np
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
### Yarn
 | 
					### Yarn
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Ensure that `yarn.lock` is always committed, pass `--frozen-lockfile` to `yarn install` when installing packages.
 | 
					To ensure that `yarn.lock` is always committed, use `yarn install --immutable` when installing packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**See also:**
 | 
					**See also:**
 | 
				
			||||||
- [Documentation of `yarn.lock`](https://classic.yarnpkg.com/en/docs/yarn-lock)
 | 
					- [Documentation of `yarn.lock`](https://classic.yarnpkg.com/en/docs/yarn-lock)
 | 
				
			||||||
- [Documentation of `--frozen-lockfile` option](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile)
 | 
					- [Documentation of `--frozen-lockfile` option](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile)
 | 
				
			||||||
- [QA - Should lockfiles be committed to the repoistory?](https://yarnpkg.com/getting-started/qa/#should-lockfiles-be-committed-to-the-repository)
 | 
					- [QA - Should lockfiles be committed to the repoistory?](https://yarnpkg.com/getting-started/qa/#should-lockfiles-be-committed-to-the-repository)
 | 
				
			||||||
 | 
					- [Documentation of `yarn install`](https://yarnpkg.com/cli/install)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### PNPM
 | 
					### PNPM
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -101,7 +102,7 @@ steps:
 | 
				
			|||||||
  with:
 | 
					  with:
 | 
				
			||||||
    node-version: '14'
 | 
					    node-version: '14'
 | 
				
			||||||
    cache: 'yarn'
 | 
					    cache: 'yarn'
 | 
				
			||||||
- run: yarn install --frozen-lockfile
 | 
					- run: yarn install --frozen-lockfile # optional, --immutable
 | 
				
			||||||
- run: yarn test
 | 
					- run: yarn test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -246,3 +247,5 @@ steps:
 | 
				
			|||||||
# `npm rebuild` will run all those post-install scripts for us.
 | 
					# `npm rebuild` will run all those post-install scripts for us.
 | 
				
			||||||
- run: npm rebuild && npm run prepare --if-present
 | 
					- run: npm rebuild && npm run prepare --if-present
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NOTE: As per https://github.com/actions/setup-node/issues/49 you cannot use `secrets.GITHUB_TOKEN` to access private GitHub Packages within the same organisation but in a different repository.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										107
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										107
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -9,12 +9,12 @@
 | 
				
			|||||||
      "version": "3.1.1",
 | 
					      "version": "3.1.1",
 | 
				
			||||||
      "license": "MIT",
 | 
					      "license": "MIT",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@actions/cache": "^2.0.2",
 | 
					        "@actions/cache": "^3.0.0",
 | 
				
			||||||
        "@actions/core": "^1.6.0",
 | 
					        "@actions/core": "^1.6.0",
 | 
				
			||||||
        "@actions/exec": "^1.1.0",
 | 
					        "@actions/exec": "^1.1.0",
 | 
				
			||||||
        "@actions/github": "^1.1.0",
 | 
					        "@actions/github": "^1.1.0",
 | 
				
			||||||
        "@actions/glob": "^0.2.0",
 | 
					        "@actions/glob": "^0.2.0",
 | 
				
			||||||
        "@actions/http-client": "^1.0.11",
 | 
					        "@actions/http-client": "^2.0.1",
 | 
				
			||||||
        "@actions/io": "^1.0.2",
 | 
					        "@actions/io": "^1.0.2",
 | 
				
			||||||
        "@actions/tool-cache": "^1.5.4",
 | 
					        "@actions/tool-cache": "^1.5.4",
 | 
				
			||||||
        "semver": "^6.1.1"
 | 
					        "semver": "^6.1.1"
 | 
				
			||||||
@@ -23,7 +23,7 @@
 | 
				
			|||||||
        "@types/jest": "^27.0.2",
 | 
					        "@types/jest": "^27.0.2",
 | 
				
			||||||
        "@types/node": "^16.11.25",
 | 
					        "@types/node": "^16.11.25",
 | 
				
			||||||
        "@types/semver": "^6.0.0",
 | 
					        "@types/semver": "^6.0.0",
 | 
				
			||||||
        "@zeit/ncc": "^0.21.0",
 | 
					        "@vercel/ncc": "^0.33.4",
 | 
				
			||||||
        "jest": "^27.2.5",
 | 
					        "jest": "^27.2.5",
 | 
				
			||||||
        "jest-circus": "^27.2.5",
 | 
					        "jest-circus": "^27.2.5",
 | 
				
			||||||
        "prettier": "^1.19.1",
 | 
					        "prettier": "^1.19.1",
 | 
				
			||||||
@@ -32,14 +32,14 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/cache": {
 | 
					    "node_modules/@actions/cache": {
 | 
				
			||||||
      "version": "2.0.2",
 | 
					      "version": "3.0.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-K1DCaW/OtHj5mV7hI7HEXiceX3rM4Nc0iG2hfYsrkEy6GiOeqlCC/LyICrBZIRDM6+vSrS12tg1ORl4hghomBA==",
 | 
					      "integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@actions/core": "^1.2.6",
 | 
					        "@actions/core": "^1.2.6",
 | 
				
			||||||
        "@actions/exec": "^1.0.1",
 | 
					        "@actions/exec": "^1.0.1",
 | 
				
			||||||
        "@actions/glob": "^0.1.0",
 | 
					        "@actions/glob": "^0.1.0",
 | 
				
			||||||
        "@actions/http-client": "^1.0.9",
 | 
					        "@actions/http-client": "^2.0.1",
 | 
				
			||||||
        "@actions/io": "^1.0.1",
 | 
					        "@actions/io": "^1.0.1",
 | 
				
			||||||
        "@azure/ms-rest-js": "^2.6.0",
 | 
					        "@azure/ms-rest-js": "^2.6.0",
 | 
				
			||||||
        "@azure/storage-blob": "^12.8.0",
 | 
					        "@azure/storage-blob": "^12.8.0",
 | 
				
			||||||
@@ -56,6 +56,14 @@
 | 
				
			|||||||
        "minimatch": "^3.0.4"
 | 
					        "minimatch": "^3.0.4"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@actions/cache/node_modules/@actions/http-client": {
 | 
				
			||||||
 | 
					      "version": "2.0.1",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "tunnel": "^0.0.6"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/cache/node_modules/uuid": {
 | 
					    "node_modules/@actions/cache/node_modules/uuid": {
 | 
				
			||||||
      "version": "3.4.0",
 | 
					      "version": "3.4.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
 | 
				
			||||||
@@ -73,6 +81,14 @@
 | 
				
			|||||||
        "@actions/http-client": "^1.0.11"
 | 
					        "@actions/http-client": "^1.0.11"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@actions/core/node_modules/@actions/http-client": {
 | 
				
			||||||
 | 
					      "version": "1.0.11",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "tunnel": "0.0.6"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/exec": {
 | 
					    "node_modules/@actions/exec": {
 | 
				
			||||||
      "version": "1.1.0",
 | 
					      "version": "1.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
 | 
				
			||||||
@@ -100,11 +116,11 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/http-client": {
 | 
					    "node_modules/@actions/http-client": {
 | 
				
			||||||
      "version": "1.0.11",
 | 
					      "version": "2.0.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
					      "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "tunnel": "0.0.6"
 | 
					        "tunnel": "^0.0.6"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@actions/io": {
 | 
					    "node_modules/@actions/io": {
 | 
				
			||||||
@@ -125,6 +141,14 @@
 | 
				
			|||||||
        "uuid": "^3.3.2"
 | 
					        "uuid": "^3.3.2"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/@actions/tool-cache/node_modules/@actions/http-client": {
 | 
				
			||||||
 | 
					      "version": "1.0.11",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "tunnel": "0.0.6"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/@azure/abort-controller": {
 | 
					    "node_modules/@azure/abort-controller": {
 | 
				
			||||||
      "version": "1.0.4",
 | 
					      "version": "1.0.4",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.4.tgz",
 | 
				
			||||||
@@ -1535,11 +1559,10 @@
 | 
				
			|||||||
      "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==",
 | 
					      "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/@zeit/ncc": {
 | 
					    "node_modules/@vercel/ncc": {
 | 
				
			||||||
      "version": "0.21.0",
 | 
					      "version": "0.33.4",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.21.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
 | 
				
			||||||
      "integrity": "sha512-RUMdvVK/w78oo+yBjruZltt0kJXYar2un/1bYQ2LuHG7GmFVm+QjxzEmySwREctaJdEnBvlMdUNWd9hXHxEI3g==",
 | 
					      "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
 | 
				
			||||||
      "deprecated": "@zeit/ncc is no longer maintained. Please use @vercel/ncc instead.",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "bin": {
 | 
					      "bin": {
 | 
				
			||||||
        "ncc": "dist/ncc/cli.js"
 | 
					        "ncc": "dist/ncc/cli.js"
 | 
				
			||||||
@@ -5080,14 +5103,14 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@actions/cache": {
 | 
					    "@actions/cache": {
 | 
				
			||||||
      "version": "2.0.2",
 | 
					      "version": "3.0.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-2.0.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.0.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-K1DCaW/OtHj5mV7hI7HEXiceX3rM4Nc0iG2hfYsrkEy6GiOeqlCC/LyICrBZIRDM6+vSrS12tg1ORl4hghomBA==",
 | 
					      "integrity": "sha512-GL9CT1Fnu+pqs8TTB621q8Xa8Cilw2n9MwvbgMedetH7L1q2n6jY61gzbwGbKgtVbp3gVJ12aNMi4osSGXx3KQ==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "@actions/core": "^1.2.6",
 | 
					        "@actions/core": "^1.2.6",
 | 
				
			||||||
        "@actions/exec": "^1.0.1",
 | 
					        "@actions/exec": "^1.0.1",
 | 
				
			||||||
        "@actions/glob": "^0.1.0",
 | 
					        "@actions/glob": "^0.1.0",
 | 
				
			||||||
        "@actions/http-client": "^1.0.9",
 | 
					        "@actions/http-client": "^2.0.1",
 | 
				
			||||||
        "@actions/io": "^1.0.1",
 | 
					        "@actions/io": "^1.0.1",
 | 
				
			||||||
        "@azure/ms-rest-js": "^2.6.0",
 | 
					        "@azure/ms-rest-js": "^2.6.0",
 | 
				
			||||||
        "@azure/storage-blob": "^12.8.0",
 | 
					        "@azure/storage-blob": "^12.8.0",
 | 
				
			||||||
@@ -5104,6 +5127,14 @@
 | 
				
			|||||||
            "minimatch": "^3.0.4"
 | 
					            "minimatch": "^3.0.4"
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        "@actions/http-client": {
 | 
				
			||||||
 | 
					          "version": "2.0.1",
 | 
				
			||||||
 | 
					          "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
 | 
				
			||||||
 | 
					          "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
 | 
				
			||||||
 | 
					          "requires": {
 | 
				
			||||||
 | 
					            "tunnel": "^0.0.6"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        "uuid": {
 | 
					        "uuid": {
 | 
				
			||||||
          "version": "3.4.0",
 | 
					          "version": "3.4.0",
 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
 | 
				
			||||||
@@ -5117,6 +5148,16 @@
 | 
				
			|||||||
      "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
 | 
					      "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "@actions/http-client": "^1.0.11"
 | 
					        "@actions/http-client": "^1.0.11"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "@actions/http-client": {
 | 
				
			||||||
 | 
					          "version": "1.0.11",
 | 
				
			||||||
 | 
					          "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
				
			||||||
 | 
					          "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
				
			||||||
 | 
					          "requires": {
 | 
				
			||||||
 | 
					            "tunnel": "0.0.6"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/exec": {
 | 
					    "@actions/exec": {
 | 
				
			||||||
@@ -5146,11 +5187,11 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/http-client": {
 | 
					    "@actions/http-client": {
 | 
				
			||||||
      "version": "1.0.11",
 | 
					      "version": "2.0.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
					      "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "tunnel": "0.0.6"
 | 
					        "tunnel": "^0.0.6"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@actions/io": {
 | 
					    "@actions/io": {
 | 
				
			||||||
@@ -5169,6 +5210,16 @@
 | 
				
			|||||||
        "@actions/io": "^1.0.1",
 | 
					        "@actions/io": "^1.0.1",
 | 
				
			||||||
        "semver": "^6.1.0",
 | 
					        "semver": "^6.1.0",
 | 
				
			||||||
        "uuid": "^3.3.2"
 | 
					        "uuid": "^3.3.2"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "@actions/http-client": {
 | 
				
			||||||
 | 
					          "version": "1.0.11",
 | 
				
			||||||
 | 
					          "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
 | 
				
			||||||
 | 
					          "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
 | 
				
			||||||
 | 
					          "requires": {
 | 
				
			||||||
 | 
					            "tunnel": "0.0.6"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@azure/abort-controller": {
 | 
					    "@azure/abort-controller": {
 | 
				
			||||||
@@ -6347,10 +6398,10 @@
 | 
				
			|||||||
      "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==",
 | 
					      "integrity": "sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "@zeit/ncc": {
 | 
					    "@vercel/ncc": {
 | 
				
			||||||
      "version": "0.21.0",
 | 
					      "version": "0.33.4",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.21.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
 | 
				
			||||||
      "integrity": "sha512-RUMdvVK/w78oo+yBjruZltt0kJXYar2un/1bYQ2LuHG7GmFVm+QjxzEmySwREctaJdEnBvlMdUNWd9hXHxEI3g==",
 | 
					      "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "abab": {
 | 
					    "abab": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
    "build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
 | 
					    "build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
 | 
				
			||||||
    "format": "prettier --write **/*.ts",
 | 
					    "format": "prettier --write **/*.ts",
 | 
				
			||||||
    "format-check": "prettier --check **/*.ts",
 | 
					    "format-check": "prettier --check **/*.ts",
 | 
				
			||||||
    "test": "jest",
 | 
					    "test": "jest --coverage",
 | 
				
			||||||
    "pre-checkin": "npm run format && npm run build && npm test"
 | 
					    "pre-checkin": "npm run format && npm run build && npm test"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
@@ -23,12 +23,12 @@
 | 
				
			|||||||
  "author": "GitHub",
 | 
					  "author": "GitHub",
 | 
				
			||||||
  "license": "MIT",
 | 
					  "license": "MIT",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@actions/cache": "^2.0.2",
 | 
					    "@actions/cache": "^3.0.0",
 | 
				
			||||||
    "@actions/core": "^1.6.0",
 | 
					    "@actions/core": "^1.6.0",
 | 
				
			||||||
    "@actions/exec": "^1.1.0",
 | 
					    "@actions/exec": "^1.1.0",
 | 
				
			||||||
    "@actions/github": "^1.1.0",
 | 
					    "@actions/github": "^1.1.0",
 | 
				
			||||||
    "@actions/glob": "^0.2.0",
 | 
					    "@actions/glob": "^0.2.0",
 | 
				
			||||||
    "@actions/http-client": "^1.0.11",
 | 
					    "@actions/http-client": "^2.0.1",
 | 
				
			||||||
    "@actions/io": "^1.0.2",
 | 
					    "@actions/io": "^1.0.2",
 | 
				
			||||||
    "@actions/tool-cache": "^1.5.4",
 | 
					    "@actions/tool-cache": "^1.5.4",
 | 
				
			||||||
    "semver": "^6.1.1"
 | 
					    "semver": "^6.1.1"
 | 
				
			||||||
@@ -37,7 +37,7 @@
 | 
				
			|||||||
    "@types/jest": "^27.0.2",
 | 
					    "@types/jest": "^27.0.2",
 | 
				
			||||||
    "@types/node": "^16.11.25",
 | 
					    "@types/node": "^16.11.25",
 | 
				
			||||||
    "@types/semver": "^6.0.0",
 | 
					    "@types/semver": "^6.0.0",
 | 
				
			||||||
    "@zeit/ncc": "^0.21.0",
 | 
					    "@vercel/ncc": "^0.33.4",
 | 
				
			||||||
    "jest": "^27.2.5",
 | 
					    "jest": "^27.2.5",
 | 
				
			||||||
    "jest-circus": "^27.2.5",
 | 
					    "jest-circus": "^27.2.5",
 | 
				
			||||||
    "prettier": "^1.19.1",
 | 
					    "prettier": "^1.19.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,18 +49,12 @@ const cachePackages = async (packageManager: string) => {
 | 
				
			|||||||
    return;
 | 
					    return;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  const cacheId = await cache.saveCache([cachePath], primaryKey);
 | 
				
			||||||
    await cache.saveCache([cachePath], primaryKey);
 | 
					  if (cacheId == -1) {
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  core.info(`Cache saved with the key: ${primaryKey}`);
 | 
					  core.info(`Cache saved with the key: ${primaryKey}`);
 | 
				
			||||||
  } catch (error) {
 | 
					 | 
				
			||||||
    if (error.name === cache.ValidationError.name) {
 | 
					 | 
				
			||||||
      throw error;
 | 
					 | 
				
			||||||
    } else if (error.name === cache.ReserveCacheError.name) {
 | 
					 | 
				
			||||||
      core.info(error.message);
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      core.warning(`${error.message}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run();
 | 
					run();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ export interface PackageManagerInfo {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const supportedPackageManagers: SupportedPackageManagers = {
 | 
					export const supportedPackageManagers: SupportedPackageManagers = {
 | 
				
			||||||
  npm: {
 | 
					  npm: {
 | 
				
			||||||
    lockFilePatterns: ['package-lock.json', 'yarn.lock'],
 | 
					    lockFilePatterns: ['package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock'],
 | 
				
			||||||
    getCacheFolderCommand: 'npm config get cache'
 | 
					    getCacheFolderCommand: 'npm config get cache'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  pnpm: {
 | 
					  pnpm: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,7 @@ export async function getNode(
 | 
				
			|||||||
) {
 | 
					) {
 | 
				
			||||||
  // Store manifest data to avoid multiple calls
 | 
					  // Store manifest data to avoid multiple calls
 | 
				
			||||||
  let manifest: INodeRelease[] | undefined;
 | 
					  let manifest: INodeRelease[] | undefined;
 | 
				
			||||||
 | 
					  let nodeVersions: INodeVersion[] | undefined;
 | 
				
			||||||
  let osPlat: string = os.platform();
 | 
					  let osPlat: string = os.platform();
 | 
				
			||||||
  let osArch: string = translateArchToDistUrl(arch);
 | 
					  let osArch: string = translateArchToDistUrl(arch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -49,6 +50,12 @@ export async function getNode(
 | 
				
			|||||||
    versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
 | 
					    versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (isLatestSyntax(versionSpec)) {
 | 
				
			||||||
 | 
					    nodeVersions = await getVersionsFromDist();
 | 
				
			||||||
 | 
					    versionSpec = await queryDistForMatch(versionSpec, arch, nodeVersions);
 | 
				
			||||||
 | 
					    core.info(`getting latest node version...`);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (checkLatest) {
 | 
					  if (checkLatest) {
 | 
				
			||||||
    core.info('Attempt to resolve the latest version from manifest...');
 | 
					    core.info('Attempt to resolve the latest version from manifest...');
 | 
				
			||||||
    const resolvedVersion = await resolveVersionFromManifest(
 | 
					    const resolvedVersion = await resolveVersionFromManifest(
 | 
				
			||||||
@@ -119,7 +126,7 @@ export async function getNode(
 | 
				
			|||||||
    // Download from nodejs.org
 | 
					    // Download from nodejs.org
 | 
				
			||||||
    //
 | 
					    //
 | 
				
			||||||
    if (!downloadPath) {
 | 
					    if (!downloadPath) {
 | 
				
			||||||
      info = await getInfoFromDist(versionSpec, arch);
 | 
					      info = await getInfoFromDist(versionSpec, arch, nodeVersions);
 | 
				
			||||||
      if (!info) {
 | 
					      if (!info) {
 | 
				
			||||||
        throw new Error(
 | 
					        throw new Error(
 | 
				
			||||||
          `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
 | 
					          `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`
 | 
				
			||||||
@@ -216,13 +223,21 @@ function resolveLtsAliasFromManifest(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
 | 
					  core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
 | 
					  // Supported formats are `lts/<alias>`, `lts/*`, and `lts/-n`. Where asterisk means highest possible LTS and -n means the nth-highest.
 | 
				
			||||||
 | 
					  const n = Number(alias);
 | 
				
			||||||
 | 
					  const aliases = Object.fromEntries(
 | 
				
			||||||
 | 
					    manifest
 | 
				
			||||||
 | 
					      .filter(x => x.lts && x.stable === stable)
 | 
				
			||||||
 | 
					      .map(x => [x.lts!.toLowerCase(), x])
 | 
				
			||||||
 | 
					      .reverse()
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					  const numbered = Object.values(aliases);
 | 
				
			||||||
  const release =
 | 
					  const release =
 | 
				
			||||||
    alias === '*'
 | 
					    alias === '*'
 | 
				
			||||||
      ? manifest.find(x => !!x.lts && x.stable === stable)
 | 
					      ? numbered[numbered.length - 1]
 | 
				
			||||||
      : manifest.find(
 | 
					      : n < 0
 | 
				
			||||||
          x => x.lts?.toLowerCase() === alias && x.stable === stable
 | 
					      ? numbered[numbered.length - 1 + n]
 | 
				
			||||||
        );
 | 
					      : aliases[alias];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!release) {
 | 
					  if (!release) {
 | 
				
			||||||
    throw new Error(
 | 
					    throw new Error(
 | 
				
			||||||
@@ -265,14 +280,18 @@ async function getInfoFromManifest(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function getInfoFromDist(
 | 
					async function getInfoFromDist(
 | 
				
			||||||
  versionSpec: string,
 | 
					  versionSpec: string,
 | 
				
			||||||
  arch: string = os.arch()
 | 
					  arch: string = os.arch(),
 | 
				
			||||||
 | 
					  nodeVersions?: INodeVersion[]
 | 
				
			||||||
): Promise<INodeVersionInfo | null> {
 | 
					): Promise<INodeVersionInfo | null> {
 | 
				
			||||||
  let osPlat: string = os.platform();
 | 
					  let osPlat: string = os.platform();
 | 
				
			||||||
  let osArch: string = translateArchToDistUrl(arch);
 | 
					  let osArch: string = translateArchToDistUrl(arch);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let version: string;
 | 
					  let version: string = await queryDistForMatch(
 | 
				
			||||||
 | 
					    versionSpec,
 | 
				
			||||||
 | 
					    arch,
 | 
				
			||||||
 | 
					    nodeVersions
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  version = await queryDistForMatch(versionSpec, arch);
 | 
					 | 
				
			||||||
  if (!version) {
 | 
					  if (!version) {
 | 
				
			||||||
    return null;
 | 
					    return null;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -349,7 +368,8 @@ function evaluateVersions(versions: string[], versionSpec: string): string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function queryDistForMatch(
 | 
					async function queryDistForMatch(
 | 
				
			||||||
  versionSpec: string,
 | 
					  versionSpec: string,
 | 
				
			||||||
  arch: string = os.arch()
 | 
					  arch: string = os.arch(),
 | 
				
			||||||
 | 
					  nodeVersions?: INodeVersion[]
 | 
				
			||||||
): Promise<string> {
 | 
					): Promise<string> {
 | 
				
			||||||
  let osPlat: string = os.platform();
 | 
					  let osPlat: string = os.platform();
 | 
				
			||||||
  let osArch: string = translateArchToDistUrl(arch);
 | 
					  let osArch: string = translateArchToDistUrl(arch);
 | 
				
			||||||
@@ -370,14 +390,14 @@ async function queryDistForMatch(
 | 
				
			|||||||
      throw new Error(`Unexpected OS '${osPlat}'`);
 | 
					      throw new Error(`Unexpected OS '${osPlat}'`);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let versions: string[] = [];
 | 
					  if (!nodeVersions) {
 | 
				
			||||||
  let nodeVersions = await getVersionsFromDist();
 | 
					    core.debug('No dist manifest cached');
 | 
				
			||||||
 | 
					    nodeVersions = await getVersionsFromDist();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (
 | 
					  let versions: string[] = [];
 | 
				
			||||||
    versionSpec === 'current' ||
 | 
					
 | 
				
			||||||
    versionSpec === 'latest' ||
 | 
					  if (isLatestSyntax(versionSpec)) {
 | 
				
			||||||
    versionSpec === 'node'
 | 
					 | 
				
			||||||
  ) {
 | 
					 | 
				
			||||||
    core.info(`getting latest node version...`);
 | 
					    core.info(`getting latest node version...`);
 | 
				
			||||||
    return nodeVersions[0].version;
 | 
					    return nodeVersions[0].version;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -482,3 +502,7 @@ export function parseNodeVersionFile(contents: string): string {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
  return nodeVersion;
 | 
					  return nodeVersion;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function isLatestSyntax(versionSpec): boolean {
 | 
				
			||||||
 | 
					  return ['current', 'latest', 'node'].includes(versionSpec);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
import * as installer from './installer';
 | 
					import * as installer from './installer';
 | 
				
			||||||
import fs from 'fs';
 | 
					import fs from 'fs';
 | 
				
			||||||
import * as auth from './authutil';
 | 
					import * as auth from './authutil';
 | 
				
			||||||
@@ -39,6 +40,14 @@ export async function run() {
 | 
				
			|||||||
      await installer.getNode(version, stable, checkLatest, auth, arch);
 | 
					      await installer.getNode(version, stable, checkLatest, auth, arch);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Output version of node is being used
 | 
				
			||||||
 | 
					    const {stdout: installedVersion} = await exec.getExecOutput(
 | 
				
			||||||
 | 
					      'node',
 | 
				
			||||||
 | 
					      ['--version'],
 | 
				
			||||||
 | 
					      {ignoreReturnCode: true}
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    core.setOutput('node-version', installedVersion);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const registryUrl: string = core.getInput('registry-url');
 | 
					    const registryUrl: string = core.getInput('registry-url');
 | 
				
			||||||
    const alwaysAuth: string = core.getInput('always-auth');
 | 
					    const alwaysAuth: string = core.getInput('always-auth');
 | 
				
			||||||
    if (registryUrl) {
 | 
					    if (registryUrl) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user