Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: actions/setup-node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.5.1
Choose a base ref
...
head repository: actions/setup-node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.6.0
Choose a head ref

Commits on Oct 17, 2022

  1. 3
    Copy the full SHA
    788c6cc View commit details

Commits on Oct 25, 2022

  1. 2
    Copy the full SHA
    16352bb View commit details

Commits on Nov 2, 2022

  1. 2
    Copy the full SHA
    00e1b66 View commit details

Commits on Nov 9, 2022

  1. 3
    Copy the full SHA
    9b8fcdc View commit details

Commits on Nov 14, 2022

  1. 2
    Copy the full SHA
    6bc15ab View commit details

Commits on Nov 17, 2022

  1. Copy the full SHA
    2349c84 View commit details
  2. 2
    Copy the full SHA
    41acaa2 View commit details

Commits on Nov 28, 2022

  1. 2
    Copy the full SHA
    3ae886e View commit details

Commits on Dec 5, 2022

  1. Copy the full SHA
    a69d45a View commit details
  2. Add unit tests

    dsame committed Dec 5, 2022
    Copy the full SHA
    e77eaac View commit details
  3. Add dist

    dsame committed Dec 5, 2022
    Copy the full SHA
    069a4f8 View commit details

Commits on Dec 6, 2022

  1. Merge pull request #637 from akv-platform/v-sdolin/npmrc-dup

    Fix scoped registries are duplicated in npmrc
    dsame authored Dec 6, 2022
    2
    Copy the full SHA
    d1b197b View commit details

Commits on Dec 9, 2022

  1. Use early return pattern

    dsame committed Dec 9, 2022
    Copy the full SHA
    676975d View commit details

Commits on Dec 12, 2022

  1. replace throw with warn

    dsame committed Dec 12, 2022
    Copy the full SHA
    b28830c View commit details
  2. Merge pull request #639 from akv-platform/v-sdolin/early-return

    Use early return pattern to avoid nested conditions
    dsame authored Dec 12, 2022
    2
    Copy the full SHA
    377c6da View commit details

Commits on Dec 14, 2022

  1. Update workflows to use reusable-workflows

    IvanZosimov committed Dec 14, 2022
    Copy the full SHA
    da18808 View commit details
  2. Update package.json

    IvanZosimov committed Dec 14, 2022
    Copy the full SHA
    772ffdd View commit details

Commits on Dec 15, 2022

  1. Setup codeql-analysis workflow

    IvanZosimov committed Dec 15, 2022
    Copy the full SHA
    8151ea1 View commit details
  2. Update codeql-analysis workflow

    IvanZosimov committed Dec 15, 2022
    Copy the full SHA
    fe4d514 View commit details
  3. Update workflows

    IvanZosimov committed Dec 15, 2022
    Copy the full SHA
    ca97bf7 View commit details
  4. Add links to reusable workflows

    IvanZosimov committed Dec 15, 2022
    Copy the full SHA
    f5ab623 View commit details

Commits on Dec 19, 2022

  1. 2
    Copy the full SHA
    bbe2ac7 View commit details
  2. Merge branch 'main' of https://github.com/akv-platform/setup-node int…

    …o apply-reusable-workflows
    IvanZosimov committed Dec 19, 2022
    Copy the full SHA
    2db3663 View commit details
  3. Update action to use reusable-workflows repo

    IvanZosimov committed Dec 19, 2022
    Copy the full SHA
    217387c View commit details

Commits on Dec 20, 2022

  1. Fix review points

    IvanZosimov committed Dec 20, 2022
    1
    Copy the full SHA
    92a07fe View commit details

Commits on Dec 22, 2022

  1. Merge pull request #647 from akv-platform/apply-reusable-workflows

    Update action to use reusable workflows
    IvanZosimov authored Dec 22, 2022
    2
    Copy the full SHA
    c406543 View commit details
  2. Update CODEOWNERS

    e-korolevskii authored Dec 22, 2022
    Copy the full SHA
    8cd2fb2 View commit details

Commits on Dec 23, 2022

  1. Merge pull request #649 from actions/update-codeowners

    Update CODEOWNERS
    marko-zivic-93 authored Dec 23, 2022
    2
    Copy the full SHA
    3e8819f View commit details

Commits on Dec 26, 2022

  1. Update CODEOWNERS

    e-korolevskii authored Dec 26, 2022
    1
    Copy the full SHA
    99e61d6 View commit details

Commits on Dec 27, 2022

  1. Merge pull request #650 from actions/update-code-owners

    Update CODEOWNERS
    marko-zivic-93 authored Dec 27, 2022
    2
    Copy the full SHA
    92a57f4 View commit details

Commits on Jan 5, 2023

  1. 3
    Copy the full SHA
    64ed1c7 View commit details
Showing with 4,556 additions and 1,493 deletions.
  1. +17 −0 .github/workflows/basic-validation.yml
  2. +0 −30 .github/workflows/build-test.yml
  3. +3 −38 .github/workflows/check-dist.yml
  4. +14 −0 .github/workflows/codeql-analysis.yml
  5. +1 −1 .github/workflows/e2e-cache.yml
  6. +4 −13 .github/workflows/licensed.yml
  7. +1 −1 .github/workflows/proxy.yml
  8. +2 −1 .github/workflows/release-new-action-version.yml
  9. +62 −2 .github/workflows/versions.yml
  10. +1 −1 .licenses/npm/minimatch.dep.yml
  11. +1 −1 CODEOWNERS
  12. +26 −8 README.md
  13. +10 −0 __tests__/README.md
  14. +82 −1 __tests__/authutil.test.ts
  15. +2 −1 __tests__/cache-utils.test.ts
  16. +531 −0 __tests__/canary-installer.test.ts
  17. +35 −0 __tests__/data/node-nightly-index.json
  18. +28 −0 __tests__/data/node-rc-index.json
  19. +537 −0 __tests__/data/v8-canary-dist-index.json
  20. +303 −0 __tests__/main.test.ts
  21. +517 −0 __tests__/nightly-installer.test.ts
  22. +43 −221 __tests__/{installer.test.ts → official-installer.test.ts}
  23. +402 −0 __tests__/rc-installer.test.ts
  24. +2 −2 action.yml
  25. +146 −94 dist/cache-save/index.js
  26. +857 −452 dist/setup/index.js
  27. +123 −0 docs/advanced-usage.md
  28. +20 −38 package-lock.json
  29. +2 −1 package.json
  30. +3 −5 src/authutil.ts
  31. +1 −1 src/cache-restore.ts
  32. +10 −11 src/cache-utils.ts
  33. +53 −0 src/distributions/base-distribution-prerelease.ts
  34. +287 −0 src/distributions/base-distribution.ts
  35. +19 −0 src/distributions/base-models.ts
  36. +31 −0 src/distributions/installer-factory.ts
  37. +13 −0 src/distributions/nightly/nightly_builds.ts
  38. +258 −0 src/distributions/official_builds/official_builds.ts
  39. +12 −0 src/distributions/rc/rc_builds.ts
  40. +13 −0 src/distributions/v8-canary/canary_builds.ts
  41. +0 −522 src/installer.ts
  42. +21 −48 src/main.ts
  43. +63 −0 src/util.ts
17 changes: 17 additions & 0 deletions .github/workflows/basic-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Basic validation

on:
pull_request:
paths-ignore:
- '**.md'
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'

jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
30 changes: 0 additions & 30 deletions .github/workflows/build-test.yml

This file was deleted.

41 changes: 3 additions & 38 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/

on:
@@ -17,36 +12,6 @@ on:
workflow_dispatch:

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm

- name: Install dependencies
run: npm ci

- name: Rebuild the dist/ directory
run: npm run build

- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
call-check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
14 changes: 14 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CodeQL analysis

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 3 * * 0'

jobs:
call-codeQL-analysis:
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/e2e-cache.yml
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16]
node-version: [14, 16]
steps:
- uses: actions/checkout@v3
- name: Yarn version
17 changes: 4 additions & 13 deletions .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
@@ -7,18 +7,9 @@ on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
name: Check licenses
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
2 changes: 1 addition & 1 deletion .github/workflows/proxy.yml
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ jobs:
options: --dns 127.0.0.1
services:
squid-proxy:
image: datadog/squid:latest
image: ubuntu/squid:latest
ports:
- 3128:3128
env:
3 changes: 2 additions & 1 deletion .github/workflows/release-new-action-version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release new action version

on:
release:
types: [released]
@@ -21,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.1.0
uses: actions/publish-action@v0.2.1
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
64 changes: 62 additions & 2 deletions .github/workflows/versions.yml
Original file line number Diff line number Diff line change
@@ -51,6 +51,66 @@ jobs:
__tests__/verify-node.sh "${BASH_REMATCH[1]}"
shell: bash

v8-canary-syntax:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['20-v8-canary', '20.0.0-v8-canary','20.0.0-v8-canary20221103f7e2421e91']
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Verify node and npm
run: |
canaryVersion="${{ matrix.node-version }}"
majorVersion=$(echo $canaryVersion | cut -d- -f1)
__tests__/verify-node.sh "$majorVersion"
shell: bash

nightly-syntax:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.0.0-nightly20210420a0261d231c, 17-nightly, 18.0.0-nightly]
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Verify node and npm
run: |
nightlyVersion="${{ matrix.node-version }}"
majorVersion=$(echo $nightlyVersion | cut -d- -f1)
__tests__/verify-node.sh "$majorVersion"
shell: bash

rc-syntax:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [16.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Verify node and npm
run: |
rcVersion="${{ matrix.node-version }}"
majorVersion=$(echo $rcVersion | cut -d- -f1)
__tests__/verify-node.sh "$majorVersion"
shell: bash

manifest:
runs-on: ${{ matrix.os }}
strategy:
@@ -178,7 +238,7 @@ jobs:
- name: Get node version
run: |
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
shell: bash
- uses: actions/checkout@v3
@@ -189,7 +249,7 @@ jobs:
- name: Retrieve version after install
run: |
updatedVersion=$(echo $(node --version))
echo "::set-output name=NODE_VERSION_UPDATED::$updatedVersion"
echo "NODE_VERSION_UPDATED=$updatedVersion" >> $GITHUB_OUTPUT
id: updatedVersion
shell: bash
- name: Compare versions
2 changes: 1 addition & 1 deletion .licenses/npm/minimatch.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @actions/actions-service
* @actions/setup-actions-team
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -111,16 +111,34 @@ jobs:
- 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

1. [Check latest version](docs/advanced-usage.md#check-latest-version)
2. [Using a node version file](docs/advanced-usage.md#node-version-file)
3. [Using different architectures](docs/advanced-usage.md#architecture)
4. [Caching packages data](docs/advanced-usage.md#caching-packages-data)
5. [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures)
6. [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
7. [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
8. [Using private packages](docs/advanced-usage.md#use-private-packages)
- [Check latest version](docs/advanced-usage.md#check-latest-version)
- [Using a node version file](docs/advanced-usage.md#node-version-file)
- [Using different architectures](docs/advanced-usage.md#architecture)
- [Using v8 canary versions](docs/advanced-usage.md#v8-canary-versions)
- [Using nigthly versions](docs/advanced-usage.md#nightly-versions)
- [Using rc versions](docs/advanced-usage.md#rc-versions)
- [Caching packages data](docs/advanced-usage.md#caching-packages-data)
- [Using multiple operating systems and architectures](docs/advanced-usage.md#multiple-operating-systems-and-architectures)
- [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
- [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
- [Using private packages](docs/advanced-usage.md#use-private-packages)

## License

10 changes: 10 additions & 0 deletions __tests__/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Files located in data directory are used only for testing purposes.


## Here the list of files in the data directory
- `.nvmrc`, `.tools-versions` and `package.json` are used to test node-version-file logic
- `package-lock.json`, `pnpm-lock.yaml` and `yarn.lock` are used to test cache logic
- `versions-manifest.json` is used for unit testing to check downloading Node.js versions from the node-versions repository.
- `node-dist-index.json` is used for unit testing to check downloading Node.js versions from the official site. The file was constructed from https://nodejs.org/dist/index.json
- `node-rc-index.json` is used for unit testing to check downloading Node.js rc versions from the official site. The file was constructed from https://nodejs.org/download/rc/index.json
- `node-nightly-index.json` is used for unit testing to check downloading Node.js nightly builds from the official site. The file was constructed from https://nodejs.org/download/nightly/index.json
Loading