mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 01:33:33 +00:00 
			
		
		
		
	Merge branch 'main' into v-dmshib/add-support-for-nightly-and-rc
This commit is contained in:
		
						commit
						7df7057afa
					
				
							
								
								
									
										2
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							@ -75,7 +75,7 @@ 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: [12, 14, 16]
 | 
					        node-version: [14, 16]
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
      - name: Yarn version
 | 
					      - name: Yarn version
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							@ -218,7 +218,7 @@ jobs:
 | 
				
			|||||||
      - name: Get node version
 | 
					      - name: Get node version
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          latestNodeVersion=$(curl https://nodejs.org/dist/index.json | jq -r '. [0].version')
 | 
					          latestNodeVersion=$(curl https://nodejs.org/dist/index.json | jq -r '. [0].version')
 | 
				
			||||||
          echo "::set-output name=LATEST_NODE_VERSION::$latestNodeVersion"
 | 
					          echo "LATEST_NODE_VERSION=$latestNodeVersion" >> $GITHUB_OUTPUT
 | 
				
			||||||
        id: version
 | 
					        id: version
 | 
				
			||||||
        shell: bash
 | 
					        shell: bash
 | 
				
			||||||
      - uses: actions/checkout@v3
 | 
					      - uses: actions/checkout@v3
 | 
				
			||||||
@ -229,7 +229,7 @@ jobs:
 | 
				
			|||||||
      - name: Retrieve version after install
 | 
					      - name: Retrieve version after install
 | 
				
			||||||
        run: |
 | 
					        run: |
 | 
				
			||||||
          updatedVersion=$(echo $(node --version))
 | 
					          updatedVersion=$(echo $(node --version))
 | 
				
			||||||
          echo "::set-output name=NODE_VERSION_UPDATED::$updatedVersion"
 | 
					          echo "NODE_VERSION_UPDATED=$updatedVersion" >> $GITHUB_OUTPUT
 | 
				
			||||||
        id: updatedVersion
 | 
					        id: updatedVersion
 | 
				
			||||||
        shell: bash
 | 
					        shell: bash
 | 
				
			||||||
      - name: Compare versions
 | 
					      - name: Compare versions
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							@ -111,6 +111,21 @@ jobs:
 | 
				
			|||||||
      - run: npm test
 | 
					      - run: npm test
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Using `setup-node` on GHES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`setup-node` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Nodejs distributions, `setup-node` downloads distributions from [`actions/node-versions`](https://github.com/actions/node-versions) on github.com (outside of the appliance). These calls to `actions/node-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly from the official site, but it also can have rate limit so it's better to put token.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					uses: actions/setup-node@v3
 | 
				
			||||||
 | 
					with:
 | 
				
			||||||
 | 
					  token: ${{ secrets.GH_DOTCOM_TOKEN }}
 | 
				
			||||||
 | 
					  node-version: 16
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Advanced usage
 | 
					## Advanced usage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1. [Check latest version](docs/advanced-usage.md#check-latest-version)
 | 
					1. [Check latest version](docs/advanced-usage.md#check-latest-version)
 | 
				
			||||||
 | 
				
			|||||||
@ -19,8 +19,8 @@ inputs:
 | 
				
			|||||||
  scope:
 | 
					  scope:
 | 
				
			||||||
    description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).'
 | 
					    description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).'
 | 
				
			||||||
  token:
 | 
					  token:
 | 
				
			||||||
    description: Used to pull node distributions from node-versions.  Since there's a default, this is typically not supplied by the user.
 | 
					    description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
 | 
				
			||||||
    default: ${{ github.token }}
 | 
					    default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
 | 
				
			||||||
  cache:
 | 
					  cache:
 | 
				
			||||||
    description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
 | 
					    description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
 | 
				
			||||||
  cache-dependency-path:
 | 
					  cache-dependency-path:
 | 
				
			||||||
 | 
				
			|||||||
@ -33,7 +33,7 @@ export async function run() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (version) {
 | 
					    if (version) {
 | 
				
			||||||
      const token = core.getInput('token');
 | 
					      const token = core.getInput('token');
 | 
				
			||||||
      const auth = !token || isGhes() ? undefined : `token ${token}`;
 | 
					      const auth = !token ? undefined : `token ${token}`;
 | 
				
			||||||
      const stable =
 | 
					      const stable =
 | 
				
			||||||
        (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
 | 
					        (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
 | 
				
			||||||
      const checkLatest =
 | 
					      const checkLatest =
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user