├── .gitattributes ├── src ├── setup-node.ts ├── main.ts ├── authutil.ts └── installer.ts ├── externals └── 7zr.exe ├── .licensed.yml ├── .prettierrc.json ├── jest.config.js ├── .github ├── eslint-compact.json ├── tsc.json ├── csslint-stylish.json ├── workflows │ ├── licensed.yml │ ├── build-test.yml │ ├── proxy.yml │ └── versions.yml └── eslint-stylish.json ├── __tests__ ├── verify-node.sh ├── verify-no-unstaged-changes.sh ├── authutil.test.ts ├── data │ ├── versions-manifest.json │ └── node-dist-index.json └── installer.test.ts ├── validate └── test.sh ├── .vscode └── launch.json ├── .licenses └── npm │ ├── wrappy.dep.yml │ ├── once.dep.yml │ ├── isexe.dep.yml │ ├── semver-5.7.0.dep.yml │ ├── semver-6.1.2.dep.yml │ ├── signal-exit.dep.yml │ ├── which.dep.yml │ ├── deprecation.dep.yml │ ├── universal-user-agent-2.1.0.dep.yml │ ├── universal-user-agent-4.0.0.dep.yml │ ├── @actions │ ├── github.dep.yml │ ├── core-1.2.6.dep.yml │ ├── io.dep.yml │ ├── exec.dep.yml │ ├── core-1.2.4.dep.yml │ ├── tool-cache.dep.yml │ ├── http-client-1.0.6.dep.yml │ └── http-client-1.0.8.dep.yml │ ├── @octokit │ ├── types.dep.yml │ ├── graphql.dep.yml │ ├── endpoint.dep.yml │ ├── request-error.dep.yml │ ├── auth-token.dep.yml │ ├── request.dep.yml │ └── rest.dep.yml │ ├── execa.dep.yml │ ├── nice-try.dep.yml │ ├── get-stream.dep.yml │ ├── os-name.dep.yml │ ├── macos-release.dep.yml │ ├── pump.dep.yml │ ├── windows-release.dep.yml │ ├── end-of-stream.dep.yml │ ├── @types │ └── node.dep.yml │ ├── is-stream.dep.yml │ ├── path-key.dep.yml │ ├── shebang-command.dep.yml │ ├── tunnel.dep.yml │ ├── atob-lite.dep.yml │ ├── btoa-lite.dep.yml │ ├── shebang-regex.dep.yml │ ├── strip-eof.dep.yml │ ├── npm-run-path.dep.yml │ ├── octokit-pagination-methods.dep.yml │ ├── cross-spawn.dep.yml │ ├── p-finally.dep.yml │ ├── uuid.dep.yml │ ├── isobject.dep.yml │ ├── is-plain-object.dep.yml │ ├── lodash.get.dep.yml │ ├── lodash.set.dep.yml │ ├── lodash.uniq.dep.yml │ ├── node-fetch.dep.yml │ └── before-after-hook.dep.yml ├── LICENSE ├── tsconfig.json ├── docs └── contributors.md ├── package.json ├── action.yml ├── .gitignore ├── CONDUCT └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | .licenses/** -diff linguist-generated=true 2 | -------------------------------------------------------------------------------- /src/setup-node.ts: -------------------------------------------------------------------------------- 1 | import {run} from './main'; 2 | 3 | run(); 4 | -------------------------------------------------------------------------------- /externals/7zr.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quartz/setup-node/main/externals/7zr.exe -------------------------------------------------------------------------------- /.licensed.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | npm: true 3 | 4 | allowed: 5 | - apache-2.0 6 | - bsd-2-clause 7 | - bsd-3-clause 8 | - isc 9 | - mit 10 | - cc0-1.0 11 | - unlicense 12 | 13 | reviewed: 14 | npm: -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "none", 8 | "bracketSpacing": false, 9 | "arrowParens": "avoid", 10 | "parser": "typescript" 11 | } -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | clearMocks: true, 3 | moduleFileExtensions: ['js', 'ts'], 4 | testEnvironment: 'node', 5 | testMatch: ['**/*.test.ts'], 6 | testRunner: 'jest-circus/runner', 7 | transform: { 8 | '^.+\\.ts$': 'ts-jest' 9 | }, 10 | verbose: true 11 | } -------------------------------------------------------------------------------- /.github/eslint-compact.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "eslint-compact", 5 | "pattern": [ 6 | { 7 | "regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$", 8 | "file": 1, 9 | "line": 2, 10 | "column": 3, 11 | "severity": 4, 12 | "message": 5, 13 | "code": 6 14 | } 15 | ] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /__tests__/verify-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -z "$1" ]; then 4 | echo "Must supply node version argument" 5 | exit 1 6 | fi 7 | 8 | node_version="$(node --version)" 9 | echo "Found node version '$node_version'" 10 | if [ -z "$(echo $node_version | grep --fixed-strings v$1)" ]; then 11 | echo "Unexpected version" 12 | exit 1 13 | fi 14 | 15 | if [ -z "$2" ]; then 16 | echo "Testing npm install" 17 | mkdir -p test-npm-install 18 | cd test-npm-install 19 | npm init -y || exit 1 20 | npm install @actions/core || exit 1 21 | else 22 | echo "Skip testing npm" 23 | fi 24 | -------------------------------------------------------------------------------- /.github/tsc.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "tsc", 5 | "pattern": [ 6 | { 7 | "name": "tsc", 8 | "regexp": "^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$", 9 | "file": 1, 10 | "line": 2, 11 | "column": 3, 12 | "severity": 4, 13 | "code": 5, 14 | "message": 6 15 | } 16 | ] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /.github/csslint-stylish.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "css-stylish", 5 | "pattern": [ 6 | { 7 | "regexp": "^([^\\s].*)$", 8 | "file": 1 9 | }, 10 | { 11 | "regexp": "^\\s+(\\d+):(\\d+)\\s+✖\\s+(.*)\\s+(.*)$", 12 | "line": 1, 13 | "column": 2, 14 | "message": 3, 15 | "code": 4, 16 | "loop": true 17 | } 18 | ] 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /validate/test.sh: -------------------------------------------------------------------------------- 1 | 2 | #/bin/bash 3 | 4 | set -e 5 | 6 | rm -rf ./temp 7 | rm -rf ./node 8 | 9 | # uncomment to use charles proxy or other debugging proxy 10 | # export NODE_TLS_REJECT_UNAUTHORIZED=0 11 | # export https_proxy=http://127.0.0.1:8888 12 | 13 | export RUNNER_TOOL_CACHE=$(pwd) 14 | export RUNNER_TEMP="${RUNNER_TOOL_CACHE}/temp" 15 | export INPUT_STABLE=true 16 | export INPUT_VERSION="12" #"0.12.7" #"12" #"11.15.0" 17 | # export your PAT with repo scope before running 18 | export INPUT_TOKEN=$GITHUB_TOKEN 19 | 20 | echo "Getting ${INPUT_VERSION} ($INPUT_STABLE) with ${INPUT_TOKEN}..." 21 | 22 | node ../dist/index.js 23 | -------------------------------------------------------------------------------- /.github/workflows/licensed.yml: -------------------------------------------------------------------------------- 1 | name: Licensed 2 | 3 | on: 4 | push: {branches: main} 5 | pull_request: {branches: main} 6 | 7 | jobs: 8 | test: 9 | runs-on: ubuntu-latest 10 | name: Check licenses 11 | steps: 12 | - uses: actions/checkout@v2 13 | - run: npm ci 14 | - name: Install licensed 15 | run: | 16 | cd $RUNNER_TEMP 17 | curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz 18 | sudo tar -xzf licensed.tar.gz 19 | sudo mv licensed /usr/local/bin/licensed 20 | - run: licensed status -------------------------------------------------------------------------------- /.github/eslint-stylish.json: -------------------------------------------------------------------------------- 1 | { 2 | "problemMatcher": [ 3 | { 4 | "owner": "eslint-stylish", 5 | "pattern": [ 6 | { 7 | "regexp": "^([^\\s].*)$", 8 | "file": 1 9 | }, 10 | { 11 | "regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$", 12 | "line": 1, 13 | "column": 2, 14 | "severity": 3, 15 | "message": 4, 16 | "code": 5, 17 | "loop": true 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /__tests__/verify-no-unstaged-changes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$(git status --porcelain)" != "" ]]; then 4 | echo ---------------------------------------- 5 | echo git status 6 | echo ---------------------------------------- 7 | git status 8 | echo ---------------------------------------- 9 | echo git diff 10 | echo ---------------------------------------- 11 | git diff 12 | echo ---------------------------------------- 13 | echo Troubleshooting 14 | echo ---------------------------------------- 15 | echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run pre-checkin" 16 | exit 1 17 | fi 18 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug Jest Tests on Nix", 9 | "type": "node", 10 | "request": "launch", 11 | "runtimeArgs": [ 12 | "--inspect-brk", 13 | "${workspaceRoot}/node_modules/.bin/jest", 14 | "--runInBand" 15 | ], 16 | "console": "integratedTerminal", 17 | "internalConsoleOptions": "neverOpen", 18 | "port": 9229 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /.github/workflows/build-test.yml: -------------------------------------------------------------------------------- 1 | name: build-test 2 | 3 | on: 4 | pull_request: 5 | paths-ignore: 6 | - '**.md' 7 | push: 8 | branches: 9 | - main 10 | - releases/* 11 | paths-ignore: 12 | - '**.md' 13 | 14 | jobs: 15 | build: 16 | runs-on: ${{ matrix.operating-system }} 17 | strategy: 18 | matrix: 19 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: Setup node 12 23 | uses: actions/setup-node@v1 24 | with: 25 | node-version: 12.x 26 | - run: npm ci 27 | - run: npm run build 28 | - run: npm run format-check 29 | - run: npm test 30 | - name: Verify no unstaged changes 31 | if: runner.os != 'windows' 32 | run: __tests__/verify-no-unstaged-changes.sh 33 | -------------------------------------------------------------------------------- /.licenses/npm/wrappy.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: wrappy 3 | version: 1.0.2 4 | type: npm 5 | summary: Callback wrapping utility 6 | homepage: https://github.com/npm/wrappy 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/once.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: once 3 | version: 1.4.0 4 | type: npm 5 | summary: Run a function exactly one time 6 | homepage: https://github.com/isaacs/once#readme 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/isexe.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: isexe 3 | version: 2.0.0 4 | type: npm 5 | summary: Minimal module to check if a file is executable. 6 | homepage: https://github.com/isaacs/isexe#readme 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/semver-5.7.0.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: semver 3 | version: 5.7.0 4 | type: npm 5 | summary: The semantic version parser used by npm. 6 | homepage: https://github.com/npm/node-semver#readme 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/semver-6.1.2.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: semver 3 | version: 6.1.2 4 | type: npm 5 | summary: The semantic version parser used by npm. 6 | homepage: https://github.com/npm/node-semver#readme 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Isaac Z. Schlueter and Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/signal-exit.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: signal-exit 3 | version: 3.0.2 4 | type: npm 5 | summary: when you want to fire an event no matter how a process exits. 6 | homepage: https://github.com/tapjs/signal-exit 7 | license: isc 8 | licenses: 9 | - sources: LICENSE.txt 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) 2015, Contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software 16 | for any purpose with or without fee is hereby granted, provided 17 | that the above copyright notice and this permission notice 18 | appear in all copies. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 21 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 22 | OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE 23 | LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES 24 | OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 25 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 26 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 | notices: [] 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /.licenses/npm/which.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: which 3 | version: 1.3.1 4 | type: npm 5 | summary: Like which(1) unix command. Find the first instance of an executable in the 6 | PATH. 7 | homepage: https://github.com/isaacs/node-which#readme 8 | license: isc 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The ISC License 13 | 14 | Copyright (c) Isaac Z. Schlueter and Contributors 15 | 16 | Permission to use, copy, modify, and/or distribute this software for any 17 | purpose with or without fee is hereby granted, provided that the above 18 | copyright notice and this permission notice appear in all copies. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 21 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 22 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 23 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 24 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 25 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 26 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 27 | notices: [] 28 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ 4 | "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ 5 | "lib": [ 6 | "es6" 7 | ], 8 | "outDir": "./lib", /* Redirect output structure to the directory. */ 9 | "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ 10 | "sourceMap": true, 11 | "strict": true, /* Enable all strict type-checking options. */ 12 | "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ 13 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ 14 | }, 15 | "exclude": ["__tests__", "lib", "node_modules"] 16 | } 17 | -------------------------------------------------------------------------------- /.licenses/npm/deprecation.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: deprecation 3 | version: 2.3.1 4 | type: npm 5 | summary: Log a deprecation message with stack 6 | homepage: https://github.com/gr2m/deprecation#readme 7 | license: isc 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The ISC License 12 | 13 | Copyright (c) Gregor Martynus and contributors 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any 16 | purpose with or without fee is hereby granted, provided that the above 17 | copyright notice and this permission notice appear in all copies. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 20 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 21 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 22 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 23 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 24 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR 25 | IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 26 | - sources: README.md 27 | text: "[ISC](LICENSE)" 28 | notices: [] 29 | -------------------------------------------------------------------------------- /.licenses/npm/universal-user-agent-2.1.0.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: universal-user-agent 3 | version: 2.1.0 4 | type: npm 5 | summary: Get a user agent string in both browser and node 6 | homepage: https://github.com/gr2m/universal-user-agent#readme 7 | license: other 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | # [ISC License](https://spdx.org/licenses/ISC) 12 | 13 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m) 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | - sources: README.md 19 | text: "[ISC](LICENSE.md)" 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/universal-user-agent-4.0.0.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: universal-user-agent 3 | version: 4.0.0 4 | type: npm 5 | summary: Get a user agent string in both browser and node 6 | homepage: https://github.com/gr2m/universal-user-agent#readme 7 | license: other 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | # [ISC License](https://spdx.org/licenses/ISC) 12 | 13 | Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m) 14 | 15 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 | - sources: README.md 19 | text: "[ISC](LICENSE.md)" 20 | notices: [] 21 | -------------------------------------------------------------------------------- /docs/contributors.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 | ### Checkin 4 | 5 | - Do checkin source (src) 6 | - Do checkin build output (lib) 7 | - Do checkin runtime node_modules 8 | - Do not checkin devDependency node_modules (husky can help see below) 9 | 10 | ### devDependencies 11 | 12 | In order to handle correctly checking in node_modules without devDependencies, we run [Husky](https://github.com/typicode/husky) before each commit. 13 | This step ensures that formatting and checkin rules are followed and that devDependencies are excluded. To make sure Husky runs correctly, please use the following workflow: 14 | 15 | ``` 16 | npm install # installs all devDependencies including Husky 17 | git add abc.ext # Add the files you've changed. This should include files in src, lib, and node_modules (see above) 18 | git commit -m "Informative commit message" # Commit. This will run Husky 19 | ``` 20 | 21 | During the commit step, Husky will take care of formatting all files with [Prettier](https://github.com/prettier/prettier) as well as pruning out devDependencies using `npm prune --production`. 22 | It will also make sure these changes are appropriately included in your commit (no further work is needed) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setup-node", 3 | "version": "2.0.0", 4 | "private": true, 5 | "description": "setup node action", 6 | "main": "lib/setup-node.js", 7 | "scripts": { 8 | "build": "tsc && ncc build", 9 | "format": "prettier --write **/*.ts", 10 | "format-check": "prettier --check **/*.ts", 11 | "test": "jest", 12 | "pre-checkin": "npm run format && npm run build && npm test" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/actions/setup-node.git" 17 | }, 18 | "keywords": [ 19 | "actions", 20 | "node", 21 | "setup" 22 | ], 23 | "author": "GitHub", 24 | "license": "MIT", 25 | "dependencies": { 26 | "@actions/core": "^1.2.6", 27 | "@actions/exec": "^1.0.3", 28 | "@actions/github": "^1.1.0", 29 | "@actions/http-client": "^1.0.6", 30 | "@actions/io": "^1.0.2", 31 | "@actions/tool-cache": "^1.5.4", 32 | "semver": "^6.1.1" 33 | }, 34 | "devDependencies": { 35 | "@types/jest": "^24.0.13", 36 | "@types/node": "^12.0.4", 37 | "@types/semver": "^6.0.0", 38 | "@zeit/ncc": "^0.21.0", 39 | "jest": "^24.9.0", 40 | "jest-circus": "^24.7.1", 41 | "prettier": "^1.19.1", 42 | "ts-jest": "^24.3.0", 43 | "typescript": "^3.8.3" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/github.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/github" 3 | version: 1.1.0 4 | type: npm 5 | summary: Actions github lib 6 | homepage: https://github.com/actions/toolkit/tree/master/packages/github 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | Copyright 2019 GitHub 12 | 13 | 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: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 | 17 | 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. 18 | notices: [] 19 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/core-1.2.6.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/core" 3 | version: 1.2.6 4 | type: npm 5 | summary: Actions core lib 6 | homepage: https://github.com/actions/toolkit/tree/main/packages/core 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright 2019 GitHub 14 | 15 | 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: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | 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. 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/io.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/io" 3 | version: 1.0.2 4 | type: npm 5 | summary: Actions io lib 6 | homepage: https://github.com/actions/toolkit/tree/master/packages/io 7 | license: mit 8 | licenses: 9 | - sources: Auto-generated MIT license text 10 | text: | 11 | MIT License 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/exec.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/exec" 3 | version: 1.0.4 4 | type: npm 5 | summary: Actions exec lib 6 | homepage: https://github.com/actions/toolkit/tree/master/packages/exec 7 | license: mit 8 | licenses: 9 | - sources: Auto-generated MIT license text 10 | text: | 11 | MIT License 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/core-1.2.4.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/core" 3 | version: 1.2.4 4 | type: npm 5 | summary: Actions core lib 6 | homepage: https://github.com/actions/toolkit/tree/master/packages/core 7 | license: mit 8 | licenses: 9 | - sources: Auto-generated MIT license text 10 | text: | 11 | MIT License 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/types.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/types" 3 | version: 2.1.1 4 | type: npm 5 | summary: Shared TypeScript definitions for Octokit projects 6 | homepage: https://github.com/octokit/types.ts#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | MIT License Copyright (c) 2019 Octokit contributors 12 | 13 | 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: 14 | 15 | The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. 16 | 17 | 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. 18 | - sources: README.md 19 | text: "[MIT](LICENSE)" 20 | notices: [] 21 | -------------------------------------------------------------------------------- /.licenses/npm/execa.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: execa 3 | version: 1.0.0 4 | type: npm 5 | summary: A better `child_process` 6 | homepage: https://github.com/sindresorhus/execa#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | 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: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | 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. 20 | - sources: readme.md 21 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 22 | notices: [] 23 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/tool-cache.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/tool-cache" 3 | version: 1.5.4 4 | type: npm 5 | summary: Actions tool-cache lib 6 | homepage: https://github.com/actions/toolkit/tree/master/packages/tool-cache 7 | license: mit 8 | licenses: 9 | - sources: Auto-generated MIT license text 10 | text: | 11 | MIT License 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy 14 | of this software and associated documentation files (the "Software"), to deal 15 | in the Software without restriction, including without limitation the rights 16 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | copies of the Software, and to permit persons to whom the Software is 18 | furnished to do so, subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | SOFTWARE. 30 | notices: [] 31 | -------------------------------------------------------------------------------- /.licenses/npm/nice-try.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: nice-try 3 | version: 1.0.5 4 | type: npm 5 | summary: Tries to execute a function and discards any error that occurs 6 | homepage: https://github.com/electerious/nice-try 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2018 Tobias Reich 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/get-stream.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: get-stream 3 | version: 4.1.0 4 | type: npm 5 | summary: Get a stream as a string, buffer, or array 6 | homepage: https://github.com/sindresorhus/get-stream#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | 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: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | 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. 20 | - sources: readme.md 21 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 22 | notices: [] 23 | -------------------------------------------------------------------------------- /.licenses/npm/os-name.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: os-name 3 | version: 3.1.0 4 | type: npm 5 | summary: 'Get the name of the current operating system. Example: macOS Sierra' 6 | homepage: https://github.com/sindresorhus/os-name#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | 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: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | 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. 20 | - sources: readme.md 21 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 22 | notices: [] 23 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/http-client-1.0.6.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/http-client" 3 | version: 1.0.6 4 | type: npm 5 | summary: Actions Http Client 6 | homepage: https://github.com/actions/http-client#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Actions Http Client for Node.js 12 | 13 | Copyright (c) GitHub, Inc. 14 | 15 | All rights reserved. 16 | 17 | MIT License 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 20 | associated documentation files (the "Software"), to deal in the Software without restriction, 21 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 23 | subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 28 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 29 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 30 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/@actions/http-client-1.0.8.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@actions/http-client" 3 | version: 1.0.8 4 | type: npm 5 | summary: Actions Http Client 6 | homepage: https://github.com/actions/http-client#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Actions Http Client for Node.js 12 | 13 | Copyright (c) GitHub, Inc. 14 | 15 | All rights reserved. 16 | 17 | MIT License 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 20 | associated documentation files (the "Software"), to deal in the Software without restriction, 21 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 22 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 23 | subject to the following conditions: 24 | 25 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 28 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 29 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 30 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/macos-release.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: macos-release 3 | version: 2.3.0 4 | type: npm 5 | summary: Get the name and version of a macOS release from the Darwin version 6 | homepage: https://github.com/sindresorhus/macos-release#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | MIT License 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | 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: 16 | 17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 18 | 19 | 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. 20 | - sources: readme.md 21 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 22 | notices: [] 23 | -------------------------------------------------------------------------------- /.licenses/npm/pump.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: pump 3 | version: 3.0.0 4 | type: npm 5 | summary: pipe streams together and close all of them if one of them closes 6 | homepage: https://github.com/mafintosh/pump#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Mathias Buus 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: MIT 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.github/workflows/proxy.yml: -------------------------------------------------------------------------------- 1 | name: proxy 2 | 3 | on: 4 | pull_request: 5 | paths-ignore: 6 | - '**.md' 7 | push: 8 | branches: 9 | - master 10 | - releases/* 11 | paths-ignore: 12 | - '**.md' 13 | 14 | jobs: 15 | test-proxy: 16 | runs-on: ubuntu-latest 17 | strategy: 18 | fail-fast: false 19 | container: 20 | image: ubuntu:latest 21 | options: --dns 127.0.0.1 22 | services: 23 | squid-proxy: 24 | image: datadog/squid:latest 25 | ports: 26 | - 3128:3128 27 | env: 28 | https_proxy: http://squid-proxy:3128 29 | steps: 30 | - uses: actions/checkout@v2 31 | - name: Clear tool cache 32 | run: rm -rf $RUNNER_TOOL_CACHE/* 33 | - name: Setup node 10 34 | uses: ./ 35 | with: 36 | node-version: 10.x 37 | - name: Verify node and npm 38 | run: __tests__/verify-node.sh 10 39 | 40 | test-bypass-proxy: 41 | runs-on: ubuntu-latest 42 | strategy: 43 | fail-fast: false 44 | env: 45 | https_proxy: http://no-such-proxy:3128 46 | no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com 47 | steps: 48 | - uses: actions/checkout@v2 49 | - name: Clear tool cache 50 | run: rm -rf $RUNNER_TOOL_CACHE/* 51 | - name: Setup node 11 52 | uses: ./ 53 | with: 54 | node-version: 11 55 | - name: Verify node and npm 56 | run: __tests__/verify-node.sh 11 57 | -------------------------------------------------------------------------------- /.licenses/npm/windows-release.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: windows-release 3 | version: 3.2.0 4 | type: npm 5 | summary: 'Get the name of a Windows version from the release number: `5.1.2600` → 6 | `XP`' 7 | homepage: https://github.com/sindresorhus/windows-release#readme 8 | license: mit 9 | licenses: 10 | - sources: license 11 | text: | 12 | MIT License 13 | 14 | Copyright (c) Sindre Sorhus (sindresorhus.com) 15 | 16 | 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: 17 | 18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 19 | 20 | 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. 21 | - sources: readme.md 22 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 23 | notices: [] 24 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/graphql.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/graphql" 3 | version: 2.1.3 4 | type: npm 5 | summary: GitHub GraphQL API client for browsers and Node 6 | homepage: https://github.com/octokit/graphql.js#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2018 Octokit contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: "[MIT](LICENSE)" 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/endpoint.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/endpoint" 3 | version: 5.5.1 4 | type: npm 5 | summary: Turns REST API endpoints into generic request options 6 | homepage: https://github.com/octokit/endpoint.js#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2018 Octokit contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: "[MIT](LICENSE)" 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/request-error.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/request-error" 3 | version: 1.2.0 4 | type: npm 5 | summary: Error class for Octokit request errors 6 | homepage: https://github.com/octokit/request-error.js#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2019 Octokit contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: "[MIT](LICENSE)" 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/end-of-stream.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: end-of-stream 3 | version: 1.4.1 4 | type: npm 5 | summary: Call a callback when a readable/writable/duplex stream has completed or failed. 6 | homepage: https://github.com/mafintosh/end-of-stream 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014 Mathias Buus 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: MIT 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/auth-token.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/auth-token" 3 | version: 2.4.0 4 | type: npm 5 | summary: GitHub API token authentication for browsers and Node.js 6 | homepage: https://github.com/octokit/auth-token.js#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2019 Octokit contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: "[MIT](LICENSE)" 34 | notices: [] 35 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup Node.js environment' 2 | description: 'Setup a Node.js environment by adding problem matchers and optionally downloading and adding it to the PATH' 3 | author: 'GitHub' 4 | inputs: 5 | always-auth: 6 | description: 'Set always-auth in npmrc' 7 | default: 'false' 8 | node-version: 9 | description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0' 10 | check-latest: 11 | description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec' 12 | default: false 13 | registry-url: 14 | description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN' 15 | scope: 16 | description: 'Optional scope for authenticating against scoped registries' 17 | token: 18 | description: Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user. 19 | default: ${{ github.token }} 20 | # TODO: add input to control forcing to pull from cloud or dist. 21 | # escape valve for someone having issues or needing the absolute latest which isn't cached yet 22 | # Deprecated option, do not use. Will not be supported after October 1, 2019 23 | version: 24 | description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019' 25 | deprecationMessage: 'The version property will not be supported after October 1, 2019. Use node-version instead' 26 | runs: 27 | using: 'node12' 28 | main: 'dist/index.js' 29 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/request.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/request" 3 | version: 5.3.1 4 | type: npm 5 | summary: Send parameterized requests to GitHub’s APIs with sensible defaults in browsers 6 | and Node 7 | homepage: https://github.com/octokit/request.js#readme 8 | license: mit 9 | licenses: 10 | - sources: LICENSE 11 | text: | 12 | The MIT License 13 | 14 | Copyright (c) 2018 Octokit contributors 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | - sources: README.md 34 | text: "[MIT](LICENSE)" 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/@octokit/rest.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@octokit/rest" 3 | version: 16.38.1 4 | type: npm 5 | summary: GitHub REST API client for Node.js 6 | homepage: https://github.com/octokit/rest.js#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer) 14 | Copyright (c) 2017-2018 Octokit contributors 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | - sources: README.md 34 | text: "[MIT](LICENSE)" 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/@types/node.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "@types/node" 3 | version: 12.0.10 4 | type: npm 5 | summary: TypeScript definitions for Node.js 6 | homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: " MIT License\r\n\r\n Copyright (c) Microsoft Corporation. All rights 11 | reserved.\r\n\r\n Permission is hereby granted, free of charge, to any person 12 | obtaining a copy\r\n of this software and associated documentation files (the 13 | \"Software\"), to deal\r\n in the Software without restriction, including without 14 | limitation the rights\r\n to use, copy, modify, merge, publish, distribute, 15 | sublicense, and/or sell\r\n copies of the Software, and to permit persons to 16 | whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n\r\n 17 | \ The above copyright notice and this permission notice shall be included in 18 | all\r\n copies or substantial portions of the Software.\r\n\r\n THE SOFTWARE 19 | IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, 20 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS 21 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS 22 | OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT 24 | OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n 25 | \ SOFTWARE\r\n" 26 | notices: [] 27 | -------------------------------------------------------------------------------- /.licenses/npm/is-stream.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: is-stream 3 | version: 1.1.0 4 | type: npm 5 | summary: Check if something is a Node.js stream 6 | homepage: https://github.com/sindresorhus/is-stream#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/path-key.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: path-key 3 | version: 2.0.1 4 | type: npm 5 | summary: Get the PATH environment variable key cross-platform 6 | homepage: https://github.com/sindresorhus/path-key#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/shebang-command.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: shebang-command 3 | version: 1.2.0 4 | type: npm 5 | summary: Get the command from a shebang 6 | homepage: https://github.com/kevva/shebang-command#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Kevin Martensson (github.com/kevva) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Kevin Martensson](http://github.com/kevva) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/tunnel.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: tunnel 3 | version: 0.0.6 4 | type: npm 5 | summary: Node HTTP/HTTPS Agents for tunneling proxies 6 | homepage: https://github.com/koichik/node-tunnel/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2012 Koichi Kobayashi 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE) 34 | license. 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/atob-lite.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: atob-lite 3 | version: 2.0.0 4 | type: npm 5 | summary: Smallest/simplest possible means of using atob with both Node and browserify 6 | homepage: https://github.com/hughsk/atob-lite 7 | license: other 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | This software is released under the MIT license: 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | this software and associated documentation files (the "Software"), to deal in 15 | the Software without restriction, including without limitation the rights to 16 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | the Software, and to permit persons to whom the Software is furnished to do so, 18 | subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | - sources: README.md 30 | text: MIT. See [LICENSE.md](http://github.com/hughsk/atob-lite/blob/master/LICENSE.md) 31 | for details. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/btoa-lite.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: btoa-lite 3 | version: 1.0.0 4 | type: npm 5 | summary: Smallest/simplest possible means of using btoa with both Node and browserify 6 | homepage: https://github.com/hughsk/btoa-lite 7 | license: other 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | This software is released under the MIT license: 12 | 13 | Permission is hereby granted, free of charge, to any person obtaining a copy of 14 | this software and associated documentation files (the "Software"), to deal in 15 | the Software without restriction, including without limitation the rights to 16 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 17 | the Software, and to permit persons to whom the Software is furnished to do so, 18 | subject to the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be included in all 21 | copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 25 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 26 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | - sources: README.md 30 | text: MIT. See [LICENSE.md](http://github.com/hughsk/btoa-lite/blob/master/LICENSE.md) 31 | for details. 32 | notices: [] 33 | -------------------------------------------------------------------------------- /.licenses/npm/shebang-regex.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: shebang-regex 3 | version: 1.0.0 4 | type: npm 5 | summary: Regular expression for matching a shebang 6 | homepage: https://github.com/sindresorhus/shebang-regex#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Sindre Sorhus](http://sindresorhus.com) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/strip-eof.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: strip-eof 3 | version: 1.0.0 4 | type: npm 5 | summary: Strip the End-Of-File (EOF) character from a string/buffer 6 | homepage: https://github.com/sindresorhus/strip-eof#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Sindre Sorhus](http://sindresorhus.com) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/npm-run-path.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: npm-run-path 3 | version: 2.0.2 4 | type: npm 5 | summary: Get your PATH prepended with locally installed binaries 6 | homepage: https://github.com/sindresorhus/npm-run-path#readme 7 | license: mit 8 | licenses: 9 | - sources: license 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) Sindre Sorhus (sindresorhus.com) 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: readme.md 33 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/octokit-pagination-methods.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: octokit-pagination-methods 3 | version: 1.1.0 4 | type: npm 5 | summary: Legacy Octokit pagination methods from v15 6 | homepage: https://github.com/gr2m/octokit-pagination-methods#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License 12 | 13 | Copyright (c) 2012 Cloud9 IDE, Inc. (Mike de Boer) 14 | Copyright (c) 2017-2018 Octokit contributors 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | - sources: README.md 34 | text: "[MIT](LICENSE)" 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/cross-spawn.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: cross-spawn 3 | version: 6.0.5 4 | type: npm 5 | summary: Cross platform child_process#spawn and child_process#spawnSync 6 | homepage: https://github.com/moxystudio/node-cross-spawn 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2018 Made With MOXY Lda 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). 34 | notices: [] 35 | -------------------------------------------------------------------------------- /.licenses/npm/p-finally.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: p-finally 3 | version: 1.0.0 4 | type: npm 5 | summary: "`Promise#finally()` ponyfill - Invoked when the promise is settled regardless 6 | of outcome" 7 | homepage: https://github.com/sindresorhus/p-finally#readme 8 | license: mit 9 | licenses: 10 | - sources: license 11 | text: | 12 | The MIT License (MIT) 13 | 14 | Copyright (c) Sindre Sorhus (sindresorhus.com) 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining a copy 17 | of this software and associated documentation files (the "Software"), to deal 18 | in the Software without restriction, including without limitation the rights 19 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | copies of the Software, and to permit persons to whom the Software is 21 | furnished to do so, subject to the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be included in 24 | all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 | THE SOFTWARE. 33 | - sources: readme.md 34 | text: MIT © [Sindre Sorhus](https://sindresorhus.com) 35 | notices: [] 36 | -------------------------------------------------------------------------------- /.licenses/npm/uuid.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: uuid 3 | version: 3.3.2 4 | type: npm 5 | summary: RFC4122 (v1, v4, and v5) UUIDs 6 | homepage: https://github.com/kelektiv/node-uuid#readme 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2010-2016 Robert Kieffer and other contributors 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | notices: 33 | - sources: AUTHORS 34 | text: |- 35 | Robert Kieffer 36 | Christoph Tavan 37 | AJ ONeal 38 | Vincent Voyer 39 | Roman Shtylman 40 | -------------------------------------------------------------------------------- /.licenses/npm/isobject.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: isobject 3 | version: 4.0.0 4 | type: npm 5 | summary: Returns true if the value is an object and not an array or null. 6 | homepage: https://github.com/jonschlinkert/isobject 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: |- 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014-2017, Jon Schlinkert. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: |- 34 | Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). 35 | Released under the [MIT License](LICENSE). 36 | 37 | *** 38 | 39 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._ 40 | notices: [] 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | lib/ 3 | __tests__/runner/* 4 | 5 | validate/temp 6 | validate/node 7 | 8 | # Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 9 | # Logs 10 | logs 11 | *.log 12 | npm-debug.log* 13 | yarn-debug.log* 14 | yarn-error.log* 15 | lerna-debug.log* 16 | 17 | # Diagnostic reports (https://nodejs.org/api/report.html) 18 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 19 | 20 | # Runtime data 21 | pids 22 | *.pid 23 | *.seed 24 | *.pid.lock 25 | 26 | # Directory for instrumented libs generated by jscoverage/JSCover 27 | lib-cov 28 | 29 | # Coverage directory used by tools like istanbul 30 | coverage 31 | *.lcov 32 | 33 | # nyc test coverage 34 | .nyc_output 35 | 36 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 37 | .grunt 38 | 39 | # Bower dependency directory (https://bower.io/) 40 | bower_components 41 | 42 | # node-waf configuration 43 | .lock-wscript 44 | 45 | # Compiled binary addons (https://nodejs.org/api/addons.html) 46 | build/Release 47 | 48 | # Dependency directories 49 | jspm_packages/ 50 | 51 | # TypeScript v1 declaration files 52 | typings/ 53 | 54 | # TypeScript cache 55 | *.tsbuildinfo 56 | 57 | # Optional npm cache directory 58 | .npm 59 | 60 | # Optional eslint cache 61 | .eslintcache 62 | 63 | # Optional REPL history 64 | .node_repl_history 65 | 66 | # Output of 'npm pack' 67 | *.tgz 68 | 69 | # Yarn Integrity file 70 | .yarn-integrity 71 | 72 | # dotenv environment variables file 73 | .env 74 | .env.test 75 | 76 | # parcel-bundler cache (https://parceljs.org/) 77 | .cache 78 | 79 | # next.js build output 80 | .next 81 | 82 | # nuxt.js build output 83 | .nuxt 84 | 85 | # vuepress build output 86 | .vuepress/dist 87 | 88 | # Serverless directories 89 | .serverless/ 90 | 91 | # FuseBox cache 92 | .fusebox/ 93 | 94 | # DynamoDB Local files 95 | .dynamodb/ 96 | -------------------------------------------------------------------------------- /.licenses/npm/is-plain-object.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: is-plain-object 3 | version: 3.0.0 4 | type: npm 5 | summary: Returns true if an object was created by the `Object` constructor. 6 | homepage: https://github.com/jonschlinkert/is-plain-object 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2014-2017, Jon Schlinkert. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | - sources: README.md 33 | text: |- 34 | Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). 35 | Released under the [MIT License](LICENSE). 36 | 37 | *** 38 | 39 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 28, 2019._ 40 | notices: [] 41 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import * as installer from './installer'; 3 | import * as auth from './authutil'; 4 | import * as path from 'path'; 5 | import {URL} from 'url'; 6 | 7 | export async function run() { 8 | try { 9 | // 10 | // Version is optional. If supplied, install / use from the tool cache 11 | // If not supplied then task is still used to setup proxy, auth, etc... 12 | // 13 | let version = core.getInput('node-version'); 14 | if (!version) { 15 | version = core.getInput('version'); 16 | } 17 | 18 | if (version) { 19 | let token = core.getInput('token'); 20 | let auth = !token || isGhes() ? undefined : `token ${token}`; 21 | let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; 22 | const checkLatest = 23 | (core.getInput('check-latest') || 'false').toUpperCase() === 'TRUE'; 24 | await installer.getNode(version, stable, checkLatest, auth); 25 | } 26 | 27 | const registryUrl: string = core.getInput('registry-url'); 28 | const alwaysAuth: string = core.getInput('always-auth'); 29 | if (registryUrl) { 30 | auth.configAuthentication(registryUrl, alwaysAuth); 31 | } 32 | 33 | const matchersPath = path.join(__dirname, '..', '.github'); 34 | console.log(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`); 35 | console.log( 36 | `##[add-matcher]${path.join(matchersPath, 'csslint-stylish.json')}` 37 | ); 38 | console.log( 39 | `##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}` 40 | ); 41 | console.log( 42 | `##[add-matcher]${path.join(matchersPath, 'eslint-compact.json')}` 43 | ); 44 | } catch (error) { 45 | core.setFailed(error.message); 46 | } 47 | } 48 | 49 | function isGhes(): boolean { 50 | const ghUrl = new URL( 51 | process.env['GITHUB_SERVER_URL'] || 'https://github.com' 52 | ); 53 | return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; 54 | } 55 | -------------------------------------------------------------------------------- /src/authutil.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as os from 'os'; 3 | import * as path from 'path'; 4 | import * as core from '@actions/core'; 5 | import * as github from '@actions/github'; 6 | 7 | export function configAuthentication(registryUrl: string, alwaysAuth: string) { 8 | const npmrc: string = path.resolve( 9 | process.env['RUNNER_TEMP'] || process.cwd(), 10 | '.npmrc' 11 | ); 12 | if (!registryUrl.endsWith('/')) { 13 | registryUrl += '/'; 14 | } 15 | 16 | writeRegistryToFile(registryUrl, npmrc, alwaysAuth); 17 | } 18 | 19 | function writeRegistryToFile( 20 | registryUrl: string, 21 | fileLocation: string, 22 | alwaysAuth: string 23 | ) { 24 | let scope: string = core.getInput('scope'); 25 | if (!scope && registryUrl.indexOf('npm.pkg.github.com') > -1) { 26 | scope = github.context.repo.owner; 27 | } 28 | if (scope && scope[0] != '@') { 29 | scope = '@' + scope; 30 | } 31 | if (scope) { 32 | scope = scope.toLowerCase(); 33 | } 34 | 35 | core.debug(`Setting auth in ${fileLocation}`); 36 | let newContents: string = ''; 37 | if (fs.existsSync(fileLocation)) { 38 | const curContents: string = fs.readFileSync(fileLocation, 'utf8'); 39 | curContents.split(os.EOL).forEach((line: string) => { 40 | // Add current contents unless they are setting the registry 41 | if (!line.toLowerCase().startsWith('registry')) { 42 | newContents += line + os.EOL; 43 | } 44 | }); 45 | } 46 | // Remove http: or https: from front of registry. 47 | const authString: string = 48 | registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}'; 49 | const registryString: string = scope 50 | ? `${scope}:registry=${registryUrl}` 51 | : `registry=${registryUrl}`; 52 | const alwaysAuthString: string = `always-auth=${alwaysAuth}`; 53 | newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`; 54 | fs.writeFileSync(fileLocation, newContents); 55 | core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation); 56 | // Export empty node_auth_token so npm doesn't complain about not being able to find it 57 | core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX'); 58 | } 59 | -------------------------------------------------------------------------------- /.licenses/npm/lodash.get.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: lodash.get 3 | version: 4.4.2 4 | type: npm 5 | summary: The lodash method `_.get` exported as a module. 6 | homepage: https://lodash.com/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright jQuery Foundation and other contributors 12 | 13 | Based on Underscore.js, copyright Jeremy Ashkenas, 14 | DocumentCloud and Investigative Reporters & Editors 15 | 16 | This software consists of voluntary contributions made by many 17 | individuals. For exact contribution history, see the revision history 18 | available at https://github.com/lodash/lodash 19 | 20 | The following license applies to all parts of this software except as 21 | documented below: 22 | 23 | ==== 24 | 25 | Permission is hereby granted, free of charge, to any person obtaining 26 | a copy of this software and associated documentation files (the 27 | "Software"), to deal in the Software without restriction, including 28 | without limitation the rights to use, copy, modify, merge, publish, 29 | distribute, sublicense, and/or sell copies of the Software, and to 30 | permit persons to whom the Software is furnished to do so, subject to 31 | the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be 34 | included in all copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 37 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 38 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 39 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 40 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 41 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 42 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | ==== 45 | 46 | Copyright and related rights for sample code are waived via CC0. Sample 47 | code is defined as all source code displayed within the prose of the 48 | documentation. 49 | 50 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 51 | 52 | ==== 53 | 54 | Files located in the node_modules and vendor directories are externally 55 | maintained libraries used by this software which have their own 56 | licenses; we recommend you read them, as their terms may differ from the 57 | terms above. 58 | notices: [] 59 | -------------------------------------------------------------------------------- /.licenses/npm/lodash.set.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: lodash.set 3 | version: 4.3.2 4 | type: npm 5 | summary: The lodash method `_.set` exported as a module. 6 | homepage: https://lodash.com/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright jQuery Foundation and other contributors 12 | 13 | Based on Underscore.js, copyright Jeremy Ashkenas, 14 | DocumentCloud and Investigative Reporters & Editors 15 | 16 | This software consists of voluntary contributions made by many 17 | individuals. For exact contribution history, see the revision history 18 | available at https://github.com/lodash/lodash 19 | 20 | The following license applies to all parts of this software except as 21 | documented below: 22 | 23 | ==== 24 | 25 | Permission is hereby granted, free of charge, to any person obtaining 26 | a copy of this software and associated documentation files (the 27 | "Software"), to deal in the Software without restriction, including 28 | without limitation the rights to use, copy, modify, merge, publish, 29 | distribute, sublicense, and/or sell copies of the Software, and to 30 | permit persons to whom the Software is furnished to do so, subject to 31 | the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be 34 | included in all copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 37 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 38 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 39 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 40 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 41 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 42 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | ==== 45 | 46 | Copyright and related rights for sample code are waived via CC0. Sample 47 | code is defined as all source code displayed within the prose of the 48 | documentation. 49 | 50 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 51 | 52 | ==== 53 | 54 | Files located in the node_modules and vendor directories are externally 55 | maintained libraries used by this software which have their own 56 | licenses; we recommend you read them, as their terms may differ from the 57 | terms above. 58 | notices: [] 59 | -------------------------------------------------------------------------------- /.licenses/npm/lodash.uniq.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: lodash.uniq 3 | version: 4.5.0 4 | type: npm 5 | summary: The lodash method `_.uniq` exported as a module. 6 | homepage: https://lodash.com/ 7 | license: mit 8 | licenses: 9 | - sources: LICENSE 10 | text: | 11 | Copyright jQuery Foundation and other contributors 12 | 13 | Based on Underscore.js, copyright Jeremy Ashkenas, 14 | DocumentCloud and Investigative Reporters & Editors 15 | 16 | This software consists of voluntary contributions made by many 17 | individuals. For exact contribution history, see the revision history 18 | available at https://github.com/lodash/lodash 19 | 20 | The following license applies to all parts of this software except as 21 | documented below: 22 | 23 | ==== 24 | 25 | Permission is hereby granted, free of charge, to any person obtaining 26 | a copy of this software and associated documentation files (the 27 | "Software"), to deal in the Software without restriction, including 28 | without limitation the rights to use, copy, modify, merge, publish, 29 | distribute, sublicense, and/or sell copies of the Software, and to 30 | permit persons to whom the Software is furnished to do so, subject to 31 | the following conditions: 32 | 33 | The above copyright notice and this permission notice shall be 34 | included in all copies or substantial portions of the Software. 35 | 36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 37 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 38 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 39 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 40 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 41 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 42 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | ==== 45 | 46 | Copyright and related rights for sample code are waived via CC0. Sample 47 | code is defined as all source code displayed within the prose of the 48 | documentation. 49 | 50 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 51 | 52 | ==== 53 | 54 | Files located in the node_modules and vendor directories are externally 55 | maintained libraries used by this software which have their own 56 | licenses; we recommend you read them, as their terms may differ from the 57 | terms above. 58 | notices: [] 59 | -------------------------------------------------------------------------------- /.licenses/npm/node-fetch.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: node-fetch 3 | version: 2.6.0 4 | type: npm 5 | summary: A light-weight module that brings window.fetch to node.js 6 | homepage: https://github.com/bitinn/node-fetch 7 | license: mit 8 | licenses: 9 | - sources: LICENSE.md 10 | text: |+ 11 | The MIT License (MIT) 12 | 13 | Copyright (c) 2016 David Frank 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | - sources: README.md 34 | text: |- 35 | MIT 36 | 37 | [npm-image]: https://flat.badgen.net/npm/v/node-fetch 38 | [npm-url]: https://www.npmjs.com/package/node-fetch 39 | [travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch 40 | [travis-url]: https://travis-ci.org/bitinn/node-fetch 41 | [codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master 42 | [codecov-url]: https://codecov.io/gh/bitinn/node-fetch 43 | [install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch 44 | [install-size-url]: https://packagephobia.now.sh/result?p=node-fetch 45 | [whatwg-fetch]: https://fetch.spec.whatwg.org/ 46 | [response-init]: https://fetch.spec.whatwg.org/#responseinit 47 | [node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams 48 | [mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers 49 | [LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md 50 | [ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md 51 | [UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md 52 | notices: [] 53 | -------------------------------------------------------------------------------- /.github/workflows/versions.yml: -------------------------------------------------------------------------------- 1 | name: versions 2 | 3 | on: 4 | pull_request: 5 | paths-ignore: 6 | - '**.md' 7 | push: 8 | branches: 9 | - main 10 | - releases/* 11 | paths-ignore: 12 | - '**.md' 13 | 14 | jobs: 15 | local-cache: 16 | runs-on: ${{ matrix.operating-system }} 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 21 | node-version: [10, 12, 14] 22 | steps: 23 | - uses: actions/checkout@v2 24 | - name: Setup Node 25 | uses: ./ 26 | with: 27 | node-version: ${{ matrix.node-version }} 28 | - name: Verify node and npm 29 | run: __tests__/verify-node.sh "${{ matrix.node-version }}" 30 | shell: bash 31 | 32 | manifest: 33 | runs-on: ${{ matrix.operating-system }} 34 | strategy: 35 | fail-fast: false 36 | matrix: 37 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 38 | node-version: [10.15, 12.16.0, 14.2.0] 39 | steps: 40 | - uses: actions/checkout@v2 41 | - name: Setup Node 42 | uses: ./ 43 | with: 44 | node-version: ${{ matrix.node-version }} 45 | - name: Verify node and npm 46 | run: __tests__/verify-node.sh "${{ matrix.node-version }}" 47 | shell: bash 48 | 49 | check-latest: 50 | runs-on: ${{ matrix.operating-system }} 51 | strategy: 52 | fail-fast: false 53 | matrix: 54 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 55 | node-version: [10, 11, 12, 14] 56 | steps: 57 | - uses: actions/checkout@v2 58 | - name: Setup Node and check latest 59 | uses: ./ 60 | with: 61 | node-version: ${{ matrix.node-version }} 62 | check-latest: true 63 | - name: Verify node and npm 64 | run: __tests__/verify-node.sh "${{ matrix.node-version }}" 65 | shell: bash 66 | 67 | node-dist: 68 | runs-on: ${{ matrix.operating-system }} 69 | strategy: 70 | fail-fast: false 71 | matrix: 72 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 73 | node-version: [11, 13] 74 | steps: 75 | - uses: actions/checkout@v2 76 | - name: Setup Node from dist 77 | uses: ./ 78 | with: 79 | node-version: ${{ matrix.node-version }} 80 | - name: Verify node and npm 81 | run: __tests__/verify-node.sh "${{ matrix.node-version }}" 82 | shell: bash 83 | 84 | old-versions: 85 | runs-on: ${{ matrix.operating-system }} 86 | strategy: 87 | fail-fast: false 88 | matrix: 89 | operating-system: [ubuntu-latest, windows-latest, macos-latest] 90 | steps: 91 | - uses: actions/checkout@v2 92 | # test old versions which didn't have npm and layout different 93 | - name: Setup node 0.12.18 from dist 94 | uses: ./ 95 | with: 96 | node-version: 0.12.18 97 | - name: Verify node 98 | run: __tests__/verify-node.sh 0.12.18 SKIP_NPM 99 | shell: bash -------------------------------------------------------------------------------- /CONDUCT: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at opensource@github.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /__tests__/authutil.test.ts: -------------------------------------------------------------------------------- 1 | import os = require('os'); 2 | import * as fs from 'fs'; 3 | import * as path from 'path'; 4 | import * as core from '@actions/core'; 5 | import * as io from '@actions/io'; 6 | import * as auth from '../src/authutil'; 7 | 8 | let rcFile: string; 9 | 10 | describe('authutil tests', () => { 11 | const _runnerDir = path.join(__dirname, 'runner'); 12 | 13 | let cnSpy: jest.SpyInstance; 14 | let logSpy: jest.SpyInstance; 15 | let dbgSpy: jest.SpyInstance; 16 | 17 | beforeAll(async () => { 18 | const randPath = path.join( 19 | Math.random() 20 | .toString(36) 21 | .substring(7) 22 | ); 23 | console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions 24 | process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible) 25 | const tempDir = path.join(_runnerDir, randPath, 'temp'); 26 | await io.rmRF(tempDir); 27 | await io.mkdirP(tempDir); 28 | process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo'; 29 | process.env['RUNNER_TEMP'] = tempDir; 30 | rcFile = path.join(tempDir, '.npmrc'); 31 | }, 100000); 32 | 33 | beforeEach(async () => { 34 | await io.rmRF(rcFile); 35 | // if (fs.existsSync(rcFile)) { 36 | // fs.unlinkSync(rcFile); 37 | // } 38 | process.env['INPUT_SCOPE'] = ''; 39 | 40 | // writes 41 | cnSpy = jest.spyOn(process.stdout, 'write'); 42 | logSpy = jest.spyOn(console, 'log'); 43 | dbgSpy = jest.spyOn(core, 'debug'); 44 | cnSpy.mockImplementation(line => { 45 | // uncomment to debug 46 | // process.stderr.write('write:' + line + '\n'); 47 | }); 48 | logSpy.mockImplementation(line => { 49 | // uncomment to debug 50 | // process.stderr.write('log:' + line + '\n'); 51 | }); 52 | dbgSpy.mockImplementation(msg => { 53 | // uncomment to see debug output 54 | // process.stderr.write(msg + '\n'); 55 | }); 56 | }, 100000); 57 | 58 | function dbg(message: string) { 59 | process.stderr.write('dbg::' + message + '::\n'); 60 | } 61 | 62 | afterAll(async () => { 63 | if (_runnerDir) { 64 | await io.rmRF(_runnerDir); 65 | } 66 | console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions 67 | }, 100000); 68 | 69 | function readRcFile(rcFile: string) { 70 | let rc = {}; 71 | let contents = fs.readFileSync(rcFile, {encoding: 'utf8'}); 72 | for (const line of contents.split(os.EOL)) { 73 | let parts = line.split('='); 74 | if (parts.length == 2) { 75 | rc[parts[0].trim()] = parts[1].trim(); 76 | } 77 | } 78 | return rc; 79 | } 80 | 81 | it('Sets up npmrc for npmjs', async () => { 82 | await auth.configAuthentication('https://registry.npmjs.org/', 'false'); 83 | 84 | expect(fs.statSync(rcFile)).toBeDefined(); 85 | let contents = fs.readFileSync(rcFile, {encoding: 'utf8'}); 86 | let rc = readRcFile(rcFile); 87 | expect(rc['registry']).toBe('https://registry.npmjs.org/'); 88 | expect(rc['always-auth']).toBe('false'); 89 | }); 90 | 91 | it('Appends trailing slash to registry', async () => { 92 | await auth.configAuthentication('https://registry.npmjs.org', 'false'); 93 | 94 | expect(fs.statSync(rcFile)).toBeDefined(); 95 | let rc = readRcFile(rcFile); 96 | expect(rc['registry']).toBe('https://registry.npmjs.org/'); 97 | expect(rc['always-auth']).toBe('false'); 98 | }); 99 | 100 | it('Configures scoped npm registries', async () => { 101 | process.env['INPUT_SCOPE'] = 'myScope'; 102 | await auth.configAuthentication('https://registry.npmjs.org', 'false'); 103 | 104 | expect(fs.statSync(rcFile)).toBeDefined(); 105 | let rc = readRcFile(rcFile); 106 | expect(rc['@myscope:registry']).toBe('https://registry.npmjs.org/'); 107 | expect(rc['always-auth']).toBe('false'); 108 | }); 109 | 110 | it('Automatically configures GPR scope', async () => { 111 | await auth.configAuthentication('npm.pkg.github.com', 'false'); 112 | 113 | expect(fs.statSync(rcFile)).toBeDefined(); 114 | let rc = readRcFile(rcFile); 115 | expect(rc['@ownername:registry']).toBe('npm.pkg.github.com/'); 116 | expect(rc['always-auth']).toBe('false'); 117 | }); 118 | 119 | it('Sets up npmrc for always-auth true', async () => { 120 | await auth.configAuthentication('https://registry.npmjs.org/', 'true'); 121 | expect(fs.statSync(rcFile)).toBeDefined(); 122 | let rc = readRcFile(rcFile); 123 | expect(rc['registry']).toBe('https://registry.npmjs.org/'); 124 | expect(rc['always-auth']).toBe('true'); 125 | }); 126 | }); 127 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # setup-node 2 | 3 |

4 | build-test status versions status proxy status 5 |

6 | 7 | This action sets by node environment for use in actions by: 8 | 9 | - optionally downloading and caching a version of node - npm by version spec and add to PATH 10 | - registering problem matchers for error output 11 | - configuring authentication for GPR or npm 12 | 13 | # v2-beta 14 | 15 | A beta release which adds reliability for pulling node distributions from a cache of node releases is available by referencing the `v2-beta` tag. 16 | 17 | ```yaml 18 | steps: 19 | - uses: actions/checkout@v2 20 | - uses: actions/setup-node@v2-beta 21 | with: 22 | node-version: '12' 23 | ``` 24 | 25 | It will first check the local cache for a semver match. The hosted images have been updated with the latest of each LTS from v8, v10, v12, and v14. `self-hosted` machines will benefit from the cache as well only downloading once. It will pull LTS versions from `main` branch of [node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json) repository and on miss or failure, it will fall back to the previous behavior of download directly from [node dist](https://nodejs.org/dist/). 26 | 27 | The `node-version` input is optional. If not supplied, node which is in your PATH will be used. However, this action will still register problem matchers and support auth features. So setting up the node environment is still a valid scenario without downloading and caching versions. 28 | 29 | # Usage 30 | 31 | See [action.yml](action.yml) 32 | 33 | Basic: 34 | ```yaml 35 | steps: 36 | - uses: actions/checkout@v2 37 | - uses: actions/setup-node@v1 38 | with: 39 | node-version: '12' 40 | - run: npm install 41 | - run: npm test 42 | ``` 43 | 44 | Check latest version: 45 | > In basic example, without `check-latest` flag, the action tries to resolve version from local cache firstly and download only if it is not found. Local cache on image is updated with a couple of weeks latency. 46 | `check-latest` flag forces the action to check if the cached version is the latest one. It reduces latency significantly but it is much more likely to incur version downloading. 47 | ```yaml 48 | steps: 49 | - uses: actions/checkout@v2 50 | - uses: actions/setup-node@v2 51 | with: 52 | node-version: '12' 53 | check-latest: true 54 | - run: npm install 55 | - run: npm test 56 | ``` 57 | 58 | Matrix Testing: 59 | ```yaml 60 | jobs: 61 | build: 62 | runs-on: ubuntu-16.04 63 | strategy: 64 | matrix: 65 | node: [ '10', '12' ] 66 | name: Node ${{ matrix.node }} sample 67 | steps: 68 | - uses: actions/checkout@v2 69 | - name: Setup node 70 | uses: actions/setup-node@v1 71 | with: 72 | node-version: ${{ matrix.node }} 73 | - run: npm install 74 | - run: npm test 75 | ``` 76 | 77 | Publish to npmjs and GPR with npm: 78 | ```yaml 79 | steps: 80 | - uses: actions/checkout@v2 81 | - uses: actions/setup-node@v1 82 | with: 83 | node-version: '10.x' 84 | registry-url: 'https://registry.npmjs.org' 85 | - run: npm install 86 | - run: npm publish 87 | env: 88 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 89 | - uses: actions/setup-node@v1 90 | with: 91 | registry-url: 'https://npm.pkg.github.com' 92 | - run: npm publish 93 | env: 94 | NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 95 | ``` 96 | 97 | Publish to npmjs and GPR with yarn: 98 | ```yaml 99 | steps: 100 | - uses: actions/checkout@v2 101 | - uses: actions/setup-node@v1 102 | with: 103 | node-version: '10.x' 104 | registry-url: 105 | - run: yarn install 106 | - run: yarn publish 107 | env: 108 | NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }} 109 | - uses: actions/setup-node@v1 110 | with: 111 | registry-url: 'https://npm.pkg.github.com' 112 | - run: yarn publish 113 | env: 114 | NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 115 | ``` 116 | 117 | Use private packages: 118 | ```yaml 119 | steps: 120 | - uses: actions/checkout@v2 121 | - uses: actions/setup-node@v1 122 | with: 123 | node-version: '10.x' 124 | registry-url: 'https://registry.npmjs.org' 125 | # Skip post-install scripts here, as a malicious 126 | # script could steal NODE_AUTH_TOKEN. 127 | - run: npm install --ignore-scripts 128 | env: 129 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 130 | # `npm rebuild` will run all those post-install scripts for us. 131 | - run: npm rebuild && npm run prepare --if-present 132 | ``` 133 | 134 | 135 | # License 136 | 137 | The scripts and documentation in this project are released under the [MIT License](LICENSE) 138 | 139 | # Contributions 140 | 141 | Contributions are welcome! See [Contributor's Guide](docs/contributors.md) 142 | 143 | ## Code of Conduct 144 | 145 | :wave: Be nice. See [our code of conduct](CONDUCT) 146 | -------------------------------------------------------------------------------- /__tests__/data/versions-manifest.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "version": "14.0.0", 4 | "stable": true, 5 | "release_url": "https://github.com/actions/node-versions/releases/tag/14.0.0-20200423.30", 6 | "files": [ 7 | { 8 | "filename": "node-14.0.0-darwin-x64.tar.gz", 9 | "arch": "x64", 10 | "platform": "darwin", 11 | "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-darwin-x64.tar.gz" 12 | }, 13 | { 14 | "filename": "node-14.0.0-linux-x64.tar.gz", 15 | "arch": "x64", 16 | "platform": "linux", 17 | "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-linux-x64.tar.gz" 18 | }, 19 | { 20 | "filename": "node-14.0.0-win32-x64.zip", 21 | "arch": "x64", 22 | "platform": "win32", 23 | "download_url": "https://github.com/actions/node-versions/releases/download/14.0.0-20200423.30/node-14.0.0-win32-x64.zip" 24 | } 25 | ] 26 | }, 27 | { 28 | "version": "13.13.0", 29 | "stable": true, 30 | "release_url": "https://github.com/actions/node-versions/releases/tag/13.13.0-20200423.29", 31 | "files": [ 32 | { 33 | "filename": "node-13.13.0-darwin-x64.tar.gz", 34 | "arch": "x64", 35 | "platform": "darwin", 36 | "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-darwin-x64.tar.gz" 37 | }, 38 | { 39 | "filename": "node-13.13.0-linux-x64.tar.gz", 40 | "arch": "x64", 41 | "platform": "linux", 42 | "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-linux-x64.tar.gz" 43 | }, 44 | { 45 | "filename": "node-13.13.0-win32-x64.zip", 46 | "arch": "x64", 47 | "platform": "win32", 48 | "download_url": "https://github.com/actions/node-versions/releases/download/13.13.0-20200423.29/node-13.13.0-win32-x64.zip" 49 | } 50 | ] 51 | }, 52 | { 53 | "version": "12.16.2", 54 | "stable": true, 55 | "release_url": "https://github.com/actions/node-versions/releases/tag/12.16.2-20200423.28", 56 | "files": [ 57 | { 58 | "filename": "node-12.16.2-darwin-x64.tar.gz", 59 | "arch": "x64", 60 | "platform": "darwin", 61 | "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-darwin-x64.tar.gz" 62 | }, 63 | { 64 | "filename": "node-12.16.2-linux-x64.tar.gz", 65 | "arch": "x64", 66 | "platform": "linux", 67 | "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz" 68 | }, 69 | { 70 | "filename": "node-12.16.2-win32-x64.zip", 71 | "arch": "x64", 72 | "platform": "win32", 73 | "download_url": "https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-win32-x64.zip" 74 | } 75 | ] 76 | }, 77 | { 78 | "version": "10.20.1", 79 | "stable": true, 80 | "release_url": "https://github.com/actions/node-versions/releases/tag/10.20.1-20200423.27", 81 | "files": [ 82 | { 83 | "filename": "node-10.20.1-darwin-x64.tar.gz", 84 | "arch": "x64", 85 | "platform": "darwin", 86 | "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-darwin-x64.tar.gz" 87 | }, 88 | { 89 | "filename": "node-10.20.1-linux-x64.tar.gz", 90 | "arch": "x64", 91 | "platform": "linux", 92 | "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-linux-x64.tar.gz" 93 | }, 94 | { 95 | "filename": "node-10.20.1-win32-x64.zip", 96 | "arch": "x64", 97 | "platform": "win32", 98 | "download_url": "https://github.com/actions/node-versions/releases/download/10.20.1-20200423.27/node-10.20.1-win32-x64.zip" 99 | } 100 | ] 101 | }, 102 | { 103 | "version": "8.17.0", 104 | "stable": true, 105 | "release_url": "https://github.com/actions/node-versions/releases/tag/8.17.0-20200423.26", 106 | "files": [ 107 | { 108 | "filename": "node-8.17.0-darwin-x64.tar.gz", 109 | "arch": "x64", 110 | "platform": "darwin", 111 | "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-darwin-x64.tar.gz" 112 | }, 113 | { 114 | "filename": "node-8.17.0-linux-x64.tar.gz", 115 | "arch": "x64", 116 | "platform": "linux", 117 | "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-linux-x64.tar.gz" 118 | }, 119 | { 120 | "filename": "node-8.17.0-win32-x64.zip", 121 | "arch": "x64", 122 | "platform": "win32", 123 | "download_url": "https://github.com/actions/node-versions/releases/download/8.17.0-20200423.26/node-8.17.0-win32-x64.zip" 124 | } 125 | ] 126 | }, 127 | { 128 | "version": "6.17.1", 129 | "stable": true, 130 | "release_url": "https://github.com/actions/node-versions/releases/tag/6.17.1-20200423.25", 131 | "files": [ 132 | { 133 | "filename": "node-6.17.1-darwin-x64.tar.gz", 134 | "arch": "x64", 135 | "platform": "darwin", 136 | "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-darwin-x64.tar.gz" 137 | }, 138 | { 139 | "filename": "node-6.17.1-linux-x64.tar.gz", 140 | "arch": "x64", 141 | "platform": "linux", 142 | "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-linux-x64.tar.gz" 143 | }, 144 | { 145 | "filename": "node-6.17.1-win32-x64.zip", 146 | "arch": "x64", 147 | "platform": "win32", 148 | "download_url": "https://github.com/actions/node-versions/releases/download/6.17.1-20200423.25/node-6.17.1-win32-x64.zip" 149 | } 150 | ] 151 | } 152 | ] -------------------------------------------------------------------------------- /src/installer.ts: -------------------------------------------------------------------------------- 1 | import os = require('os'); 2 | import * as assert from 'assert'; 3 | import * as core from '@actions/core'; 4 | import * as hc from '@actions/http-client'; 5 | import * as io from '@actions/io'; 6 | import * as tc from '@actions/tool-cache'; 7 | import * as path from 'path'; 8 | import * as semver from 'semver'; 9 | import fs = require('fs'); 10 | 11 | // 12 | // Node versions interface 13 | // see https://nodejs.org/dist/index.json 14 | // 15 | export interface INodeVersion { 16 | version: string; 17 | files: string[]; 18 | } 19 | 20 | interface INodeVersionInfo { 21 | downloadUrl: string; 22 | resolvedVersion: string; 23 | fileName: string; 24 | } 25 | 26 | export async function getNode( 27 | versionSpec: string, 28 | stable: boolean, 29 | checkLatest: boolean, 30 | auth: string | undefined 31 | ) { 32 | let osPlat: string = os.platform(); 33 | let osArch: string = translateArchToDistUrl(os.arch()); 34 | 35 | if (checkLatest) { 36 | core.info('Attempt to resolve the latest version from manifest...'); 37 | const resolvedVersion = await resolveVersionFromManifest( 38 | versionSpec, 39 | stable, 40 | auth 41 | ); 42 | if (resolvedVersion) { 43 | versionSpec = resolvedVersion; 44 | core.info(`Resolved as '${versionSpec}'`); 45 | } else { 46 | core.info(`Failed to resolve version ${versionSpec} from manifest`); 47 | } 48 | } 49 | 50 | // check cache 51 | let toolPath: string; 52 | toolPath = tc.find('node', versionSpec); 53 | 54 | // If not found in cache, download 55 | if (toolPath) { 56 | core.info(`Found in cache @ ${toolPath}`); 57 | } else { 58 | core.info(`Attempting to download ${versionSpec}...`); 59 | let downloadPath = ''; 60 | let info: INodeVersionInfo | null = null; 61 | 62 | // 63 | // Try download from internal distribution (popular versions only) 64 | // 65 | try { 66 | info = await getInfoFromManifest(versionSpec, stable, auth); 67 | if (info) { 68 | core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`); 69 | downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth); 70 | } else { 71 | core.info( 72 | 'Not found in manifest. Falling back to download directly from Node' 73 | ); 74 | } 75 | } catch (err) { 76 | // Rate limit? 77 | if ( 78 | err instanceof tc.HTTPError && 79 | (err.httpStatusCode === 403 || err.httpStatusCode === 429) 80 | ) { 81 | core.info( 82 | `Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded` 83 | ); 84 | } else { 85 | core.info(err.message); 86 | } 87 | core.debug(err.stack); 88 | core.info('Falling back to download directly from Node'); 89 | } 90 | 91 | // 92 | // Download from nodejs.org 93 | // 94 | if (!downloadPath) { 95 | info = await getInfoFromDist(versionSpec); 96 | if (!info) { 97 | throw new Error( 98 | `Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.` 99 | ); 100 | } 101 | 102 | core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`); 103 | try { 104 | downloadPath = await tc.downloadTool(info.downloadUrl); 105 | } catch (err) { 106 | if (err instanceof tc.HTTPError && err.httpStatusCode == 404) { 107 | return await acquireNodeFromFallbackLocation(info.resolvedVersion); 108 | } 109 | 110 | throw err; 111 | } 112 | } 113 | 114 | // 115 | // Extract 116 | // 117 | core.info('Extracting ...'); 118 | let extPath: string; 119 | info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here 120 | if (osPlat == 'win32') { 121 | let _7zPath = path.join(__dirname, '..', 'externals', '7zr.exe'); 122 | extPath = await tc.extract7z(downloadPath, undefined, _7zPath); 123 | // 7z extracts to folder matching file name 124 | let nestedPath = path.join(extPath, path.basename(info.fileName, '.7z')); 125 | if (fs.existsSync(nestedPath)) { 126 | extPath = nestedPath; 127 | } 128 | } else { 129 | extPath = await tc.extractTar(downloadPath, undefined, [ 130 | 'xz', 131 | '--strip', 132 | '1' 133 | ]); 134 | } 135 | 136 | // 137 | // Install into the local tool cache - node extracts with a root folder that matches the fileName downloaded 138 | // 139 | core.info('Adding to the cache ...'); 140 | toolPath = await tc.cacheDir(extPath, 'node', info.resolvedVersion); 141 | core.info('Done'); 142 | } 143 | 144 | // 145 | // a tool installer initimately knows details about the layout of that tool 146 | // for example, node binary is in the bin folder after the extract on Mac/Linux. 147 | // layouts could change by version, by platform etc... but that's the tool installers job 148 | // 149 | if (osPlat != 'win32') { 150 | toolPath = path.join(toolPath, 'bin'); 151 | } 152 | 153 | // 154 | // prepend the tools path. instructs the agent to prepend for future tasks 155 | core.addPath(toolPath); 156 | } 157 | 158 | async function getInfoFromManifest( 159 | versionSpec: string, 160 | stable: boolean, 161 | auth: string | undefined 162 | ): Promise { 163 | let info: INodeVersionInfo | null = null; 164 | const releases = await tc.getManifestFromRepo( 165 | 'actions', 166 | 'node-versions', 167 | auth, 168 | 'main' 169 | ); 170 | const rel = await tc.findFromManifest(versionSpec, stable, releases); 171 | 172 | if (rel && rel.files.length > 0) { 173 | info = {}; 174 | info.resolvedVersion = rel.version; 175 | info.downloadUrl = rel.files[0].download_url; 176 | info.fileName = rel.files[0].filename; 177 | } 178 | 179 | return info; 180 | } 181 | 182 | async function getInfoFromDist( 183 | versionSpec: string 184 | ): Promise { 185 | let osPlat: string = os.platform(); 186 | let osArch: string = translateArchToDistUrl(os.arch()); 187 | 188 | let version: string; 189 | 190 | version = await queryDistForMatch(versionSpec); 191 | if (!version) { 192 | return null; 193 | } 194 | 195 | // 196 | // Download - a tool installer intimately knows how to get the tool (and construct urls) 197 | // 198 | version = semver.clean(version) || ''; 199 | let fileName: string = 200 | osPlat == 'win32' 201 | ? `node-v${version}-win-${osArch}` 202 | : `node-v${version}-${osPlat}-${osArch}`; 203 | let urlFileName: string = 204 | osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`; 205 | let url = `https://nodejs.org/dist/v${version}/${urlFileName}`; 206 | 207 | return { 208 | downloadUrl: url, 209 | resolvedVersion: version, 210 | fileName: fileName 211 | }; 212 | } 213 | 214 | async function resolveVersionFromManifest( 215 | versionSpec: string, 216 | stable: boolean, 217 | auth: string | undefined 218 | ): Promise { 219 | try { 220 | const info = await getInfoFromManifest(versionSpec, stable, auth); 221 | return info?.resolvedVersion; 222 | } catch (err) { 223 | core.info('Unable to resolve version from manifest...'); 224 | core.debug(err.message); 225 | } 226 | } 227 | 228 | // TODO - should we just export this from @actions/tool-cache? Lifted directly from there 229 | function evaluateVersions(versions: string[], versionSpec: string): string { 230 | let version = ''; 231 | core.debug(`evaluating ${versions.length} versions`); 232 | versions = versions.sort((a, b) => { 233 | if (semver.gt(a, b)) { 234 | return 1; 235 | } 236 | return -1; 237 | }); 238 | for (let i = versions.length - 1; i >= 0; i--) { 239 | const potential: string = versions[i]; 240 | const satisfied: boolean = semver.satisfies(potential, versionSpec); 241 | if (satisfied) { 242 | version = potential; 243 | break; 244 | } 245 | } 246 | 247 | if (version) { 248 | core.debug(`matched: ${version}`); 249 | } else { 250 | core.debug('match not found'); 251 | } 252 | 253 | return version; 254 | } 255 | 256 | async function queryDistForMatch(versionSpec: string): Promise { 257 | let osPlat: string = os.platform(); 258 | let osArch: string = translateArchToDistUrl(os.arch()); 259 | 260 | // node offers a json list of versions 261 | let dataFileName: string; 262 | switch (osPlat) { 263 | case 'linux': 264 | dataFileName = `linux-${osArch}`; 265 | break; 266 | case 'darwin': 267 | dataFileName = `osx-${osArch}-tar`; 268 | break; 269 | case 'win32': 270 | dataFileName = `win-${osArch}-exe`; 271 | break; 272 | default: 273 | throw new Error(`Unexpected OS '${osPlat}'`); 274 | } 275 | 276 | let versions: string[] = []; 277 | let nodeVersions = await module.exports.getVersionsFromDist(); 278 | 279 | nodeVersions.forEach((nodeVersion: INodeVersion) => { 280 | // ensure this version supports your os and platform 281 | if (nodeVersion.files.indexOf(dataFileName) >= 0) { 282 | versions.push(nodeVersion.version); 283 | } 284 | }); 285 | 286 | // get the latest version that matches the version spec 287 | let version: string = evaluateVersions(versions, versionSpec); 288 | return version; 289 | } 290 | 291 | export async function getVersionsFromDist(): Promise { 292 | let dataUrl = 'https://nodejs.org/dist/index.json'; 293 | let httpClient = new hc.HttpClient('setup-node', [], { 294 | allowRetries: true, 295 | maxRetries: 3 296 | }); 297 | let response = await httpClient.getJson(dataUrl); 298 | return response.result || []; 299 | } 300 | 301 | // For non LTS versions of Node, the files we need (for Windows) are sometimes located 302 | // in a different folder than they normally are for other versions. 303 | // Normally the format is similar to: https://nodejs.org/dist/v5.10.1/node-v5.10.1-win-x64.7z 304 | // In this case, there will be two files located at: 305 | // /dist/v5.10.1/win-x64/node.exe 306 | // /dist/v5.10.1/win-x64/node.lib 307 | // If this is not the structure, there may also be two files located at: 308 | // /dist/v0.12.18/node.exe 309 | // /dist/v0.12.18/node.lib 310 | // This method attempts to download and cache the resources from these alternative locations. 311 | // Note also that the files are normally zipped but in this case they are just an exe 312 | // and lib file in a folder, not zipped. 313 | async function acquireNodeFromFallbackLocation( 314 | version: string 315 | ): Promise { 316 | let osPlat: string = os.platform(); 317 | let osArch: string = translateArchToDistUrl(os.arch()); 318 | 319 | // Create temporary folder to download in to 320 | const tempDownloadFolder: string = 321 | 'temp_' + Math.floor(Math.random() * 2000000000); 322 | const tempDirectory = process.env['RUNNER_TEMP'] || ''; 323 | assert.ok(tempDirectory, 'Expected RUNNER_TEMP to be defined'); 324 | const tempDir: string = path.join(tempDirectory, tempDownloadFolder); 325 | await io.mkdirP(tempDir); 326 | let exeUrl: string; 327 | let libUrl: string; 328 | try { 329 | exeUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.exe`; 330 | libUrl = `https://nodejs.org/dist/v${version}/win-${osArch}/node.lib`; 331 | 332 | core.info(`Downloading only node binary from ${exeUrl}`); 333 | 334 | const exePath = await tc.downloadTool(exeUrl); 335 | await io.cp(exePath, path.join(tempDir, 'node.exe')); 336 | const libPath = await tc.downloadTool(libUrl); 337 | await io.cp(libPath, path.join(tempDir, 'node.lib')); 338 | } catch (err) { 339 | if (err instanceof tc.HTTPError && err.httpStatusCode == 404) { 340 | exeUrl = `https://nodejs.org/dist/v${version}/node.exe`; 341 | libUrl = `https://nodejs.org/dist/v${version}/node.lib`; 342 | 343 | const exePath = await tc.downloadTool(exeUrl); 344 | await io.cp(exePath, path.join(tempDir, 'node.exe')); 345 | const libPath = await tc.downloadTool(libUrl); 346 | await io.cp(libPath, path.join(tempDir, 'node.lib')); 347 | } else { 348 | throw err; 349 | } 350 | } 351 | let toolPath = await tc.cacheDir(tempDir, 'node', version); 352 | core.addPath(toolPath); 353 | return toolPath; 354 | } 355 | 356 | // os.arch does not always match the relative download url, e.g. 357 | // os.arch == 'arm' != node-v12.13.1-linux-armv7l.tar.gz 358 | // All other currently supported architectures match, e.g.: 359 | // os.arch = arm64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-arm64.tar.gz 360 | // os.arch = x64 => https://nodejs.org/dist/v{VERSION}/node-v{VERSION}-{OS}-x64.tar.gz 361 | function translateArchToDistUrl(arch: string): string { 362 | switch (arch) { 363 | case 'arm': 364 | return 'armv7l'; 365 | default: 366 | return arch; 367 | } 368 | } 369 | -------------------------------------------------------------------------------- /.licenses/npm/before-after-hook.dep.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: before-after-hook 3 | version: 2.1.0 4 | type: npm 5 | summary: asynchronous before/error/after hooks for internal functionality 6 | homepage: https://github.com/gr2m/before-after-hook#readme 7 | license: apache-2.0 8 | licenses: 9 | - sources: LICENSE 10 | text: |2 11 | Apache License 12 | Version 2.0, January 2004 13 | http://www.apache.org/licenses/ 14 | 15 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 16 | 17 | 1. Definitions. 18 | 19 | "License" shall mean the terms and conditions for use, reproduction, 20 | and distribution as defined by Sections 1 through 9 of this document. 21 | 22 | "Licensor" shall mean the copyright owner or entity authorized by 23 | the copyright owner that is granting the License. 24 | 25 | "Legal Entity" shall mean the union of the acting entity and all 26 | other entities that control, are controlled by, or are under common 27 | control with that entity. For the purposes of this definition, 28 | "control" means (i) the power, direct or indirect, to cause the 29 | direction or management of such entity, whether by contract or 30 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 31 | outstanding shares, or (iii) beneficial ownership of such entity. 32 | 33 | "You" (or "Your") shall mean an individual or Legal Entity 34 | exercising permissions granted by this License. 35 | 36 | "Source" form shall mean the preferred form for making modifications, 37 | including but not limited to software source code, documentation 38 | source, and configuration files. 39 | 40 | "Object" form shall mean any form resulting from mechanical 41 | transformation or translation of a Source form, including but 42 | not limited to compiled object code, generated documentation, 43 | and conversions to other media types. 44 | 45 | "Work" shall mean the work of authorship, whether in Source or 46 | Object form, made available under the License, as indicated by a 47 | copyright notice that is included in or attached to the work 48 | (an example is provided in the Appendix below). 49 | 50 | "Derivative Works" shall mean any work, whether in Source or Object 51 | form, that is based on (or derived from) the Work and for which the 52 | editorial revisions, annotations, elaborations, or other modifications 53 | represent, as a whole, an original work of authorship. For the purposes 54 | of this License, Derivative Works shall not include works that remain 55 | separable from, or merely link (or bind by name) to the interfaces of, 56 | the Work and Derivative Works thereof. 57 | 58 | "Contribution" shall mean any work of authorship, including 59 | the original version of the Work and any modifications or additions 60 | to that Work or Derivative Works thereof, that is intentionally 61 | submitted to Licensor for inclusion in the Work by the copyright owner 62 | or by an individual or Legal Entity authorized to submit on behalf of 63 | the copyright owner. For the purposes of this definition, "submitted" 64 | means any form of electronic, verbal, or written communication sent 65 | to the Licensor or its representatives, including but not limited to 66 | communication on electronic mailing lists, source code control systems, 67 | and issue tracking systems that are managed by, or on behalf of, the 68 | Licensor for the purpose of discussing and improving the Work, but 69 | excluding communication that is conspicuously marked or otherwise 70 | designated in writing by the copyright owner as "Not a Contribution." 71 | 72 | "Contributor" shall mean Licensor and any individual or Legal Entity 73 | on behalf of whom a Contribution has been received by Licensor and 74 | subsequently incorporated within the Work. 75 | 76 | 2. Grant of Copyright License. Subject to the terms and conditions of 77 | this License, each Contributor hereby grants to You a perpetual, 78 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 79 | copyright license to reproduce, prepare Derivative Works of, 80 | publicly display, publicly perform, sublicense, and distribute the 81 | Work and such Derivative Works in Source or Object form. 82 | 83 | 3. Grant of Patent License. Subject to the terms and conditions of 84 | this License, each Contributor hereby grants to You a perpetual, 85 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 86 | (except as stated in this section) patent license to make, have made, 87 | use, offer to sell, sell, import, and otherwise transfer the Work, 88 | where such license applies only to those patent claims licensable 89 | by such Contributor that are necessarily infringed by their 90 | Contribution(s) alone or by combination of their Contribution(s) 91 | with the Work to which such Contribution(s) was submitted. If You 92 | institute patent litigation against any entity (including a 93 | cross-claim or counterclaim in a lawsuit) alleging that the Work 94 | or a Contribution incorporated within the Work constitutes direct 95 | or contributory patent infringement, then any patent licenses 96 | granted to You under this License for that Work shall terminate 97 | as of the date such litigation is filed. 98 | 99 | 4. Redistribution. You may reproduce and distribute copies of the 100 | Work or Derivative Works thereof in any medium, with or without 101 | modifications, and in Source or Object form, provided that You 102 | meet the following conditions: 103 | 104 | (a) You must give any other recipients of the Work or 105 | Derivative Works a copy of this License; and 106 | 107 | (b) You must cause any modified files to carry prominent notices 108 | stating that You changed the files; and 109 | 110 | (c) You must retain, in the Source form of any Derivative Works 111 | that You distribute, all copyright, patent, trademark, and 112 | attribution notices from the Source form of the Work, 113 | excluding those notices that do not pertain to any part of 114 | the Derivative Works; and 115 | 116 | (d) If the Work includes a "NOTICE" text file as part of its 117 | distribution, then any Derivative Works that You distribute must 118 | include a readable copy of the attribution notices contained 119 | within such NOTICE file, excluding those notices that do not 120 | pertain to any part of the Derivative Works, in at least one 121 | of the following places: within a NOTICE text file distributed 122 | as part of the Derivative Works; within the Source form or 123 | documentation, if provided along with the Derivative Works; or, 124 | within a display generated by the Derivative Works, if and 125 | wherever such third-party notices normally appear. The contents 126 | of the NOTICE file are for informational purposes only and 127 | do not modify the License. You may add Your own attribution 128 | notices within Derivative Works that You distribute, alongside 129 | or as an addendum to the NOTICE text from the Work, provided 130 | that such additional attribution notices cannot be construed 131 | as modifying the License. 132 | 133 | You may add Your own copyright statement to Your modifications and 134 | may provide additional or different license terms and conditions 135 | for use, reproduction, or distribution of Your modifications, or 136 | for any such Derivative Works as a whole, provided Your use, 137 | reproduction, and distribution of the Work otherwise complies with 138 | the conditions stated in this License. 139 | 140 | 5. Submission of Contributions. Unless You explicitly state otherwise, 141 | any Contribution intentionally submitted for inclusion in the Work 142 | by You to the Licensor shall be under the terms and conditions of 143 | this License, without any additional terms or conditions. 144 | Notwithstanding the above, nothing herein shall supersede or modify 145 | the terms of any separate license agreement you may have executed 146 | with Licensor regarding such Contributions. 147 | 148 | 6. Trademarks. This License does not grant permission to use the trade 149 | names, trademarks, service marks, or product names of the Licensor, 150 | except as required for reasonable and customary use in describing the 151 | origin of the Work and reproducing the content of the NOTICE file. 152 | 153 | 7. Disclaimer of Warranty. Unless required by applicable law or 154 | agreed to in writing, Licensor provides the Work (and each 155 | Contributor provides its Contributions) on an "AS IS" BASIS, 156 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 157 | implied, including, without limitation, any warranties or conditions 158 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 159 | PARTICULAR PURPOSE. You are solely responsible for determining the 160 | appropriateness of using or redistributing the Work and assume any 161 | risks associated with Your exercise of permissions under this License. 162 | 163 | 8. Limitation of Liability. In no event and under no legal theory, 164 | whether in tort (including negligence), contract, or otherwise, 165 | unless required by applicable law (such as deliberate and grossly 166 | negligent acts) or agreed to in writing, shall any Contributor be 167 | liable to You for damages, including any direct, indirect, special, 168 | incidental, or consequential damages of any character arising as a 169 | result of this License or out of the use or inability to use the 170 | Work (including but not limited to damages for loss of goodwill, 171 | work stoppage, computer failure or malfunction, or any and all 172 | other commercial damages or losses), even if such Contributor 173 | has been advised of the possibility of such damages. 174 | 175 | 9. Accepting Warranty or Additional Liability. While redistributing 176 | the Work or Derivative Works thereof, You may choose to offer, 177 | and charge a fee for, acceptance of support, warranty, indemnity, 178 | or other liability obligations and/or rights consistent with this 179 | License. However, in accepting such obligations, You may act only 180 | on Your own behalf and on Your sole responsibility, not on behalf 181 | of any other Contributor, and only if You agree to indemnify, 182 | defend, and hold each Contributor harmless for any liability 183 | incurred by, or claims asserted against, such Contributor by reason 184 | of your accepting any such warranty or additional liability. 185 | 186 | END OF TERMS AND CONDITIONS 187 | 188 | APPENDIX: How to apply the Apache License to your work. 189 | 190 | To apply the Apache License to your work, attach the following 191 | boilerplate notice, with the fields enclosed by brackets "{}" 192 | replaced with your own identifying information. (Don't include 193 | the brackets!) The text should be enclosed in the appropriate 194 | comment syntax for the file format. We also recommend that a 195 | file or class name and description of purpose be included on the 196 | same "printed page" as the copyright notice for easier 197 | identification within third-party archives. 198 | 199 | Copyright 2018 Gregor Martynus and other contributors. 200 | 201 | Licensed under the Apache License, Version 2.0 (the "License"); 202 | you may not use this file except in compliance with the License. 203 | You may obtain a copy of the License at 204 | 205 | http://www.apache.org/licenses/LICENSE-2.0 206 | 207 | Unless required by applicable law or agreed to in writing, software 208 | distributed under the License is distributed on an "AS IS" BASIS, 209 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 210 | See the License for the specific language governing permissions and 211 | limitations under the License. 212 | - sources: README.md 213 | text: "[Apache 2.0](LICENSE)" 214 | notices: [] 215 | -------------------------------------------------------------------------------- /__tests__/installer.test.ts: -------------------------------------------------------------------------------- 1 | import * as core from '@actions/core'; 2 | import * as io from '@actions/io'; 3 | import * as tc from '@actions/tool-cache'; 4 | import fs from 'fs'; 5 | import cp from 'child_process'; 6 | import osm = require('os'); 7 | import path from 'path'; 8 | import * as main from '../src/main'; 9 | import * as im from '../src/installer'; 10 | import * as auth from '../src/authutil'; 11 | import {context} from '@actions/github'; 12 | 13 | let nodeTestManifest = require('./data/versions-manifest.json'); 14 | let nodeTestDist = require('./data/node-dist-index.json'); 15 | 16 | // let matchers = require('../matchers.json'); 17 | // let matcherPattern = matchers.problemMatcher[0].pattern[0]; 18 | // let matcherRegExp = new RegExp(matcherPattern.regexp); 19 | 20 | describe('setup-node', () => { 21 | let inputs = {} as any; 22 | let os = {} as any; 23 | 24 | let inSpy: jest.SpyInstance; 25 | let findSpy: jest.SpyInstance; 26 | let cnSpy: jest.SpyInstance; 27 | let logSpy: jest.SpyInstance; 28 | let warningSpy: jest.SpyInstance; 29 | let getManifestSpy: jest.SpyInstance; 30 | let getDistSpy: jest.SpyInstance; 31 | let platSpy: jest.SpyInstance; 32 | let archSpy: jest.SpyInstance; 33 | let dlSpy: jest.SpyInstance; 34 | let exSpy: jest.SpyInstance; 35 | let cacheSpy: jest.SpyInstance; 36 | let dbgSpy: jest.SpyInstance; 37 | let whichSpy: jest.SpyInstance; 38 | let existsSpy: jest.SpyInstance; 39 | let mkdirpSpy: jest.SpyInstance; 40 | let execSpy: jest.SpyInstance; 41 | let authSpy: jest.SpyInstance; 42 | 43 | beforeEach(() => { 44 | // @actions/core 45 | console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions 46 | process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out 47 | inputs = {}; 48 | inSpy = jest.spyOn(core, 'getInput'); 49 | inSpy.mockImplementation(name => inputs[name]); 50 | 51 | // node 52 | os = {}; 53 | platSpy = jest.spyOn(osm, 'platform'); 54 | platSpy.mockImplementation(() => os['platform']); 55 | archSpy = jest.spyOn(osm, 'arch'); 56 | archSpy.mockImplementation(() => os['arch']); 57 | execSpy = jest.spyOn(cp, 'execSync'); 58 | 59 | // @actions/tool-cache 60 | findSpy = jest.spyOn(tc, 'find'); 61 | dlSpy = jest.spyOn(tc, 'downloadTool'); 62 | exSpy = jest.spyOn(tc, 'extractTar'); 63 | cacheSpy = jest.spyOn(tc, 'cacheDir'); 64 | getManifestSpy = jest.spyOn(tc, 'getManifestFromRepo'); 65 | getDistSpy = jest.spyOn(im, 'getVersionsFromDist'); 66 | 67 | // io 68 | whichSpy = jest.spyOn(io, 'which'); 69 | existsSpy = jest.spyOn(fs, 'existsSync'); 70 | mkdirpSpy = jest.spyOn(io, 'mkdirP'); 71 | 72 | // disable authentication portion for installer tests 73 | authSpy = jest.spyOn(auth, 'configAuthentication'); 74 | authSpy.mockImplementation(() => {}); 75 | 76 | // gets 77 | getManifestSpy.mockImplementation( 78 | () => nodeTestManifest 79 | ); 80 | getDistSpy.mockImplementation(() => nodeTestDist); 81 | 82 | // writes 83 | cnSpy = jest.spyOn(process.stdout, 'write'); 84 | logSpy = jest.spyOn(core, 'info'); 85 | dbgSpy = jest.spyOn(core, 'debug'); 86 | warningSpy = jest.spyOn(core, 'warning'); 87 | cnSpy.mockImplementation(line => { 88 | // uncomment to debug 89 | // process.stderr.write('write:' + line + '\n'); 90 | }); 91 | logSpy.mockImplementation(line => { 92 | // uncomment to debug 93 | // process.stderr.write('log:' + line + '\n'); 94 | }); 95 | dbgSpy.mockImplementation(msg => { 96 | // uncomment to see debug output 97 | // process.stderr.write(msg + '\n'); 98 | }); 99 | }); 100 | 101 | afterEach(() => { 102 | jest.resetAllMocks(); 103 | jest.clearAllMocks(); 104 | //jest.restoreAllMocks(); 105 | }); 106 | 107 | afterAll(async () => { 108 | console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions 109 | }, 100000); 110 | 111 | //-------------------------------------------------- 112 | // Manifest find tests 113 | //-------------------------------------------------- 114 | it('can mock manifest versions', async () => { 115 | let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( 116 | 'actions', 117 | 'node-versions', 118 | 'mocktoken' 119 | ); 120 | expect(versions).toBeDefined(); 121 | expect(versions?.length).toBe(6); 122 | }); 123 | 124 | it('can mock dist versions', async () => { 125 | let versions: im.INodeVersion[] = await im.getVersionsFromDist(); 126 | expect(versions).toBeDefined(); 127 | expect(versions?.length).toBe(23); 128 | }); 129 | 130 | it('can find 12.16.2 from manifest on osx', async () => { 131 | os.platform = 'darwin'; 132 | os.arch = 'x64'; 133 | let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( 134 | 'actions', 135 | 'node-versions', 136 | 'mocktoken' 137 | ); 138 | expect(versions).toBeDefined(); 139 | let match = await tc.findFromManifest('12.16.2', true, versions); 140 | expect(match).toBeDefined(); 141 | expect(match?.version).toBe('12.16.2'); 142 | }); 143 | 144 | it('can find 12 from manifest on linux', async () => { 145 | os.platform = 'linux'; 146 | os.arch = 'x64'; 147 | let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( 148 | 'actions', 149 | 'node-versions', 150 | 'mocktoken' 151 | ); 152 | expect(versions).toBeDefined(); 153 | let match = await tc.findFromManifest('12.16.2', true, versions); 154 | expect(match).toBeDefined(); 155 | expect(match?.version).toBe('12.16.2'); 156 | }); 157 | 158 | it('can find 10 from manifest on windows', async () => { 159 | os.platform = 'win32'; 160 | os.arch = 'x64'; 161 | let versions: tc.IToolRelease[] | null = await tc.getManifestFromRepo( 162 | 'actions', 163 | 'node-versions', 164 | 'mocktoken' 165 | ); 166 | expect(versions).toBeDefined(); 167 | let match = await tc.findFromManifest('10', true, versions); 168 | expect(match).toBeDefined(); 169 | expect(match?.version).toBe('10.20.1'); 170 | }); 171 | 172 | //-------------------------------------------------- 173 | // Found in cache tests 174 | //-------------------------------------------------- 175 | 176 | it('finds version in cache with stable true', async () => { 177 | inputs['node-version'] = '12'; 178 | inputs.stable = 'true'; 179 | 180 | let toolPath = path.normalize('/cache/node/12.16.1/x64'); 181 | findSpy.mockImplementation(() => toolPath); 182 | await main.run(); 183 | 184 | expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); 185 | }); 186 | 187 | it('finds version in cache with stable not supplied', async () => { 188 | inputs['node-version'] = '12'; 189 | 190 | inSpy.mockImplementation(name => inputs[name]); 191 | 192 | let toolPath = path.normalize('/cache/node/12.16.1/x64'); 193 | findSpy.mockImplementation(() => toolPath); 194 | await main.run(); 195 | 196 | expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); 197 | }); 198 | 199 | it('finds version in cache and adds it to the path', async () => { 200 | inputs['node-version'] = '12'; 201 | 202 | inSpy.mockImplementation(name => inputs[name]); 203 | 204 | let toolPath = path.normalize('/cache/node/12.16.1/x64'); 205 | findSpy.mockImplementation(() => toolPath); 206 | await main.run(); 207 | 208 | let expPath = path.join(toolPath, 'bin'); 209 | expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); 210 | }); 211 | 212 | it('handles unhandled find error and reports error', async () => { 213 | let errMsg = 'unhandled error message'; 214 | inputs['node-version'] = '12'; 215 | 216 | findSpy.mockImplementation(() => { 217 | throw new Error(errMsg); 218 | }); 219 | 220 | await main.run(); 221 | 222 | expect(cnSpy).toHaveBeenCalledWith('::error::' + errMsg + osm.EOL); 223 | }); 224 | 225 | it('downloads a version from a manifest match', async () => { 226 | os.platform = 'linux'; 227 | os.arch = 'x64'; 228 | 229 | // a version which is in the manifest 230 | let versionSpec = '12.16.2'; 231 | let resolvedVersion = versionSpec; 232 | 233 | inputs['node-version'] = versionSpec; 234 | inputs['always-auth'] = false; 235 | inputs['token'] = 'faketoken'; 236 | 237 | let expectedUrl = 238 | 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; 239 | 240 | // ... but not in the local cache 241 | findSpy.mockImplementation(() => ''); 242 | 243 | dlSpy.mockImplementation(async () => '/some/temp/path'); 244 | let toolPath = path.normalize('/cache/node/12.16.2/x64'); 245 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 246 | cacheSpy.mockImplementation(async () => toolPath); 247 | 248 | await main.run(); 249 | 250 | let expPath = path.join(toolPath, 'bin'); 251 | 252 | expect(dlSpy).toHaveBeenCalled(); 253 | expect(exSpy).toHaveBeenCalled(); 254 | expect(logSpy).toHaveBeenCalledWith( 255 | `Acquiring ${resolvedVersion} from ${expectedUrl}` 256 | ); 257 | expect(logSpy).toHaveBeenCalledWith( 258 | `Attempting to download ${versionSpec}...` 259 | ); 260 | expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); 261 | }); 262 | 263 | it('falls back to a version from node dist', async () => { 264 | os.platform = 'linux'; 265 | os.arch = 'x64'; 266 | 267 | // a version which is not in the manifest but is in node dist 268 | let versionSpec = '11.15.0'; 269 | let resolvedVersion = versionSpec; 270 | 271 | inputs['node-version'] = versionSpec; 272 | inputs['always-auth'] = false; 273 | inputs['token'] = 'faketoken'; 274 | 275 | let expectedUrl = 276 | 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; 277 | 278 | // ... but not in the local cache 279 | findSpy.mockImplementation(() => ''); 280 | 281 | dlSpy.mockImplementation(async () => '/some/temp/path'); 282 | let toolPath = path.normalize('/cache/node/11.11.0/x64'); 283 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 284 | cacheSpy.mockImplementation(async () => toolPath); 285 | 286 | await main.run(); 287 | 288 | let expPath = path.join(toolPath, 'bin'); 289 | 290 | expect(dlSpy).toHaveBeenCalled(); 291 | expect(exSpy).toHaveBeenCalled(); 292 | expect(logSpy).toHaveBeenCalledWith( 293 | 'Not found in manifest. Falling back to download directly from Node' 294 | ); 295 | expect(logSpy).toHaveBeenCalledWith( 296 | `Attempting to download ${versionSpec}...` 297 | ); 298 | expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); 299 | }); 300 | 301 | it('does not find a version that does not exist', async () => { 302 | os.platform = 'linux'; 303 | os.arch = 'x64'; 304 | 305 | let versionSpec = '9.99.9'; 306 | inputs['node-version'] = versionSpec; 307 | 308 | findSpy.mockImplementation(() => ''); 309 | await main.run(); 310 | 311 | expect(logSpy).toHaveBeenCalledWith( 312 | 'Not found in manifest. Falling back to download directly from Node' 313 | ); 314 | expect(logSpy).toHaveBeenCalledWith( 315 | `Attempting to download ${versionSpec}...` 316 | ); 317 | expect(cnSpy).toHaveBeenCalledWith( 318 | `::error::Unable to find Node version '${versionSpec}' for platform ${os.platform} and architecture ${os.arch}.${osm.EOL}` 319 | ); 320 | }); 321 | 322 | it('reports a failed download', async () => { 323 | let errMsg = 'unhandled download message'; 324 | os.platform = 'linux'; 325 | os.arch = 'x64'; 326 | 327 | // a version which is in the manifest 328 | let versionSpec = '12.16.2'; 329 | let resolvedVersion = versionSpec; 330 | 331 | inputs['node-version'] = versionSpec; 332 | inputs['always-auth'] = false; 333 | inputs['token'] = 'faketoken'; 334 | 335 | findSpy.mockImplementation(() => ''); 336 | dlSpy.mockImplementation(() => { 337 | throw new Error(errMsg); 338 | }); 339 | await main.run(); 340 | 341 | expect(cnSpy).toHaveBeenCalledWith(`::error::${errMsg}${osm.EOL}`); 342 | }); 343 | 344 | describe('check-latest flag', () => { 345 | it('use local version and dont check manifest if check-latest is not specified', async () => { 346 | os.platform = 'linux'; 347 | os.arch = 'x64'; 348 | 349 | inputs['node-version'] = '12'; 350 | inputs['check-latest'] = 'false'; 351 | 352 | const toolPath = path.normalize('/cache/node/12.16.1/x64'); 353 | findSpy.mockReturnValue(toolPath); 354 | await main.run(); 355 | 356 | expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); 357 | expect(logSpy).not.toHaveBeenCalledWith( 358 | 'Attempt to resolve the latest version from manifest...' 359 | ); 360 | }); 361 | 362 | it('check latest version and resolve it from local cache', async () => { 363 | os.platform = 'linux'; 364 | os.arch = 'x64'; 365 | 366 | inputs['node-version'] = '12'; 367 | inputs['check-latest'] = 'true'; 368 | 369 | const toolPath = path.normalize('/cache/node/12.16.2/x64'); 370 | findSpy.mockReturnValue(toolPath); 371 | dlSpy.mockImplementation(async () => '/some/temp/path'); 372 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 373 | cacheSpy.mockImplementation(async () => toolPath); 374 | 375 | await main.run(); 376 | 377 | expect(logSpy).toHaveBeenCalledWith( 378 | 'Attempt to resolve the latest version from manifest...' 379 | ); 380 | expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'"); 381 | expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); 382 | }); 383 | 384 | it('check latest version and install it from manifest', async () => { 385 | os.platform = 'linux'; 386 | os.arch = 'x64'; 387 | 388 | inputs['node-version'] = '12'; 389 | inputs['check-latest'] = 'true'; 390 | 391 | findSpy.mockImplementation(() => ''); 392 | dlSpy.mockImplementation(async () => '/some/temp/path'); 393 | const toolPath = path.normalize('/cache/node/12.16.2/x64'); 394 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 395 | cacheSpy.mockImplementation(async () => toolPath); 396 | const expectedUrl = 397 | 'https://github.com/actions/node-versions/releases/download/12.16.2-20200423.28/node-12.16.2-linux-x64.tar.gz'; 398 | 399 | await main.run(); 400 | 401 | expect(logSpy).toHaveBeenCalledWith( 402 | 'Attempt to resolve the latest version from manifest...' 403 | ); 404 | expect(logSpy).toHaveBeenCalledWith("Resolved as '12.16.2'"); 405 | expect(logSpy).toHaveBeenCalledWith( 406 | `Acquiring 12.16.2 from ${expectedUrl}` 407 | ); 408 | expect(logSpy).toHaveBeenCalledWith('Extracting ...'); 409 | }); 410 | 411 | it('fallback to dist if version if not found in manifest', async () => { 412 | os.platform = 'linux'; 413 | os.arch = 'x64'; 414 | 415 | // a version which is not in the manifest but is in node dist 416 | let versionSpec = '11'; 417 | 418 | inputs['node-version'] = versionSpec; 419 | inputs['check-latest'] = 'true'; 420 | inputs['always-auth'] = false; 421 | inputs['token'] = 'faketoken'; 422 | 423 | // ... but not in the local cache 424 | findSpy.mockImplementation(() => ''); 425 | 426 | dlSpy.mockImplementation(async () => '/some/temp/path'); 427 | let toolPath = path.normalize('/cache/node/11.11.0/x64'); 428 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 429 | cacheSpy.mockImplementation(async () => toolPath); 430 | 431 | await main.run(); 432 | 433 | let expPath = path.join(toolPath, 'bin'); 434 | 435 | expect(dlSpy).toHaveBeenCalled(); 436 | expect(exSpy).toHaveBeenCalled(); 437 | expect(logSpy).toHaveBeenCalledWith( 438 | 'Attempt to resolve the latest version from manifest...' 439 | ); 440 | expect(logSpy).toHaveBeenCalledWith( 441 | `Failed to resolve version ${versionSpec} from manifest` 442 | ); 443 | expect(logSpy).toHaveBeenCalledWith( 444 | `Attempting to download ${versionSpec}...` 445 | ); 446 | expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); 447 | }); 448 | 449 | it('fallback to dist if manifest is not available', async () => { 450 | os.platform = 'linux'; 451 | os.arch = 'x64'; 452 | 453 | // a version which is not in the manifest but is in node dist 454 | let versionSpec = '12'; 455 | 456 | inputs['node-version'] = versionSpec; 457 | inputs['check-latest'] = 'true'; 458 | inputs['always-auth'] = false; 459 | inputs['token'] = 'faketoken'; 460 | 461 | // ... but not in the local cache 462 | findSpy.mockImplementation(() => ''); 463 | getManifestSpy.mockImplementation(() => { 464 | throw new Error('Unable to download manifest'); 465 | }); 466 | 467 | dlSpy.mockImplementation(async () => '/some/temp/path'); 468 | let toolPath = path.normalize('/cache/node/12.11.0/x64'); 469 | exSpy.mockImplementation(async () => '/some/other/temp/path'); 470 | cacheSpy.mockImplementation(async () => toolPath); 471 | 472 | await main.run(); 473 | 474 | let expPath = path.join(toolPath, 'bin'); 475 | 476 | expect(dlSpy).toHaveBeenCalled(); 477 | expect(exSpy).toHaveBeenCalled(); 478 | expect(logSpy).toHaveBeenCalledWith( 479 | 'Attempt to resolve the latest version from manifest...' 480 | ); 481 | expect(logSpy).toHaveBeenCalledWith( 482 | 'Unable to resolve version from manifest...' 483 | ); 484 | expect(logSpy).toHaveBeenCalledWith( 485 | `Failed to resolve version ${versionSpec} from manifest` 486 | ); 487 | expect(logSpy).toHaveBeenCalledWith( 488 | `Attempting to download ${versionSpec}...` 489 | ); 490 | expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); 491 | }); 492 | }); 493 | }); 494 | -------------------------------------------------------------------------------- /__tests__/data/node-dist-index.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "version": "v14.1.0", 4 | "date": "2020-04-29", 5 | "files": [ 6 | "aix-ppc64", 7 | "headers", 8 | "linux-arm64", 9 | "linux-armv7l", 10 | "linux-ppc64le", 11 | "linux-s390x", 12 | "linux-x64", 13 | "osx-x64-pkg", 14 | "osx-x64-tar", 15 | "src", 16 | "win-x64-7z", 17 | "win-x64-exe", 18 | "win-x64-msi", 19 | "win-x64-zip", 20 | "win-x86-7z", 21 | "win-x86-exe", 22 | "win-x86-msi", 23 | "win-x86-zip" 24 | ], 25 | "npm": "6.14.4", 26 | "v8": "8.1.307.31", 27 | "uv": "1.37.0", 28 | "zlib": "1.2.11", 29 | "openssl": "1.1.1g", 30 | "modules": "83", 31 | "lts": false, 32 | "security": false 33 | }, 34 | { 35 | "version": "v14.0.0", 36 | "date": "2020-04-21", 37 | "files": [ 38 | "aix-ppc64", 39 | "headers", 40 | "linux-arm64", 41 | "linux-armv7l", 42 | "linux-ppc64le", 43 | "linux-s390x", 44 | "linux-x64", 45 | "osx-x64-pkg", 46 | "osx-x64-tar", 47 | "src", 48 | "win-x64-7z", 49 | "win-x64-exe", 50 | "win-x64-msi", 51 | "win-x64-zip", 52 | "win-x86-7z", 53 | "win-x86-exe", 54 | "win-x86-msi", 55 | "win-x86-zip" 56 | ], 57 | "npm": "6.14.4", 58 | "v8": "8.1.307.30", 59 | "uv": "1.37.0", 60 | "zlib": "1.2.11", 61 | "openssl": "1.1.1f", 62 | "modules": "83", 63 | "lts": false, 64 | "security": false 65 | }, 66 | { 67 | "version": "v13.14.0", 68 | "date": "2020-04-28", 69 | "files": [ 70 | "aix-ppc64", 71 | "headers", 72 | "linux-arm64", 73 | "linux-armv7l", 74 | "linux-ppc64le", 75 | "linux-s390x", 76 | "linux-x64", 77 | "osx-x64-pkg", 78 | "osx-x64-tar", 79 | "src", 80 | "sunos-x64", 81 | "win-x64-7z", 82 | "win-x64-exe", 83 | "win-x64-msi", 84 | "win-x64-zip", 85 | "win-x86-7z", 86 | "win-x86-exe", 87 | "win-x86-msi", 88 | "win-x86-zip" 89 | ], 90 | "npm": "6.14.4", 91 | "v8": "7.9.317.25", 92 | "uv": "1.37.0", 93 | "zlib": "1.2.11", 94 | "openssl": "1.1.1g", 95 | "modules": "79", 96 | "lts": false, 97 | "security": false 98 | }, 99 | { 100 | "version": "v13.13.0", 101 | "date": "2020-04-14", 102 | "files": [ 103 | "aix-ppc64", 104 | "headers", 105 | "linux-arm64", 106 | "linux-armv7l", 107 | "linux-ppc64le", 108 | "linux-s390x", 109 | "linux-x64", 110 | "osx-x64-pkg", 111 | "osx-x64-tar", 112 | "src", 113 | "sunos-x64", 114 | "win-x64-7z", 115 | "win-x64-exe", 116 | "win-x64-msi", 117 | "win-x64-zip", 118 | "win-x86-7z", 119 | "win-x86-exe", 120 | "win-x86-msi", 121 | "win-x86-zip" 122 | ], 123 | "npm": "6.14.4", 124 | "v8": "7.9.317.25", 125 | "uv": "1.35.0", 126 | "zlib": "1.2.11", 127 | "openssl": "1.1.1f", 128 | "modules": "79", 129 | "lts": false, 130 | "security": false 131 | }, 132 | { 133 | "version": "v12.16.3", 134 | "date": "2020-04-28", 135 | "files": [ 136 | "aix-ppc64", 137 | "headers", 138 | "linux-arm64", 139 | "linux-armv7l", 140 | "linux-ppc64le", 141 | "linux-s390x", 142 | "linux-x64", 143 | "osx-x64-pkg", 144 | "osx-x64-tar", 145 | "src", 146 | "sunos-x64", 147 | "win-x64-7z", 148 | "win-x64-exe", 149 | "win-x64-msi", 150 | "win-x64-zip", 151 | "win-x86-7z", 152 | "win-x86-exe", 153 | "win-x86-msi", 154 | "win-x86-zip" 155 | ], 156 | "npm": "6.14.4", 157 | "v8": "7.8.279.23", 158 | "uv": "1.34.2", 159 | "zlib": "1.2.11", 160 | "openssl": "1.1.1g", 161 | "modules": "72", 162 | "lts": "Erbium", 163 | "security": false 164 | }, 165 | { 166 | "version": "v12.16.2", 167 | "date": "2020-04-08", 168 | "files": [ 169 | "aix-ppc64", 170 | "headers", 171 | "linux-arm64", 172 | "linux-armv7l", 173 | "linux-ppc64le", 174 | "linux-s390x", 175 | "linux-x64", 176 | "osx-x64-pkg", 177 | "osx-x64-tar", 178 | "src", 179 | "sunos-x64", 180 | "win-x64-7z", 181 | "win-x64-exe", 182 | "win-x64-msi", 183 | "win-x64-zip", 184 | "win-x86-7z", 185 | "win-x86-exe", 186 | "win-x86-msi", 187 | "win-x86-zip" 188 | ], 189 | "npm": "6.14.4", 190 | "v8": "7.8.279.23", 191 | "uv": "1.34.2", 192 | "zlib": "1.2.11", 193 | "openssl": "1.1.1e", 194 | "modules": "72", 195 | "lts": "Erbium", 196 | "security": false 197 | }, 198 | { 199 | "version": "v12.1.0", 200 | "date": "2019-04-29", 201 | "files": [ 202 | "aix-ppc64", 203 | "headers", 204 | "linux-arm64", 205 | "linux-armv7l", 206 | "linux-ppc64le", 207 | "linux-s390x", 208 | "linux-x64", 209 | "osx-x64-pkg", 210 | "osx-x64-tar", 211 | "src", 212 | "sunos-x64", 213 | "win-x64-7z", 214 | "win-x64-exe", 215 | "win-x64-msi", 216 | "win-x64-zip", 217 | "win-x86-7z", 218 | "win-x86-exe", 219 | "win-x86-msi", 220 | "win-x86-zip" 221 | ], 222 | "npm": "6.9.0", 223 | "v8": "7.4.288.21", 224 | "uv": "1.28.0", 225 | "zlib": "1.2.11", 226 | "openssl": "1.1.1b", 227 | "modules": "72", 228 | "lts": false, 229 | "security": false 230 | }, 231 | { 232 | "version": "v11.15.0", 233 | "date": "2019-04-30", 234 | "files": [ 235 | "aix-ppc64", 236 | "headers", 237 | "linux-arm64", 238 | "linux-armv6l", 239 | "linux-armv7l", 240 | "linux-ppc64le", 241 | "linux-s390x", 242 | "linux-x64", 243 | "osx-x64-pkg", 244 | "osx-x64-tar", 245 | "src", 246 | "sunos-x64", 247 | "win-x64-7z", 248 | "win-x64-exe", 249 | "win-x64-msi", 250 | "win-x64-zip", 251 | "win-x86-7z", 252 | "win-x86-exe", 253 | "win-x86-msi", 254 | "win-x86-zip" 255 | ], 256 | "npm": "6.7.0", 257 | "v8": "7.0.276.38", 258 | "uv": "1.27.0", 259 | "zlib": "1.2.11", 260 | "openssl": "1.1.1b", 261 | "modules": "67", 262 | "lts": false, 263 | "security": false 264 | }, 265 | { 266 | "version": "v10.20.1", 267 | "date": "2020-04-10", 268 | "files": [ 269 | "aix-ppc64", 270 | "headers", 271 | "linux-arm64", 272 | "linux-armv6l", 273 | "linux-armv7l", 274 | "linux-ppc64le", 275 | "linux-s390x", 276 | "linux-x64", 277 | "osx-x64-pkg", 278 | "osx-x64-tar", 279 | "src", 280 | "sunos-x64", 281 | "win-x64-7z", 282 | "win-x64-exe", 283 | "win-x64-msi", 284 | "win-x64-zip", 285 | "win-x86-7z", 286 | "win-x86-exe", 287 | "win-x86-msi", 288 | "win-x86-zip" 289 | ], 290 | "npm": "6.14.4", 291 | "v8": "6.8.275.32", 292 | "uv": "1.34.2", 293 | "zlib": "1.2.11", 294 | "openssl": "1.1.1e", 295 | "modules": "64", 296 | "lts": "Dubnium", 297 | "security": false 298 | }, 299 | { 300 | "version": "v10.20.0", 301 | "date": "2020-03-24", 302 | "files": [ 303 | "aix-ppc64", 304 | "headers", 305 | "linux-arm64", 306 | "linux-armv6l", 307 | "linux-armv7l", 308 | "linux-ppc64le", 309 | "linux-s390x", 310 | "linux-x64", 311 | "osx-x64-pkg", 312 | "osx-x64-tar", 313 | "src", 314 | "sunos-x64", 315 | "win-x64-7z", 316 | "win-x64-exe", 317 | "win-x64-msi", 318 | "win-x64-zip", 319 | "win-x86-7z", 320 | "win-x86-exe", 321 | "win-x86-msi", 322 | "win-x86-zip" 323 | ], 324 | "npm": "6.14.4", 325 | "v8": "6.8.275.32", 326 | "uv": "1.34.2", 327 | "zlib": "1.2.11", 328 | "openssl": "1.1.1e", 329 | "modules": "64", 330 | "lts": "Dubnium", 331 | "security": false 332 | }, 333 | { 334 | "version": "v9.11.2", 335 | "date": "2018-06-12", 336 | "files": [ 337 | "aix-ppc64", 338 | "headers", 339 | "linux-arm64", 340 | "linux-armv6l", 341 | "linux-armv7l", 342 | "linux-ppc64le", 343 | "linux-s390x", 344 | "linux-x64", 345 | "linux-x86", 346 | "osx-x64-pkg", 347 | "osx-x64-tar", 348 | "src", 349 | "sunos-x64", 350 | "sunos-x86", 351 | "win-x64-7z", 352 | "win-x64-exe", 353 | "win-x64-msi", 354 | "win-x64-zip", 355 | "win-x86-7z", 356 | "win-x86-exe", 357 | "win-x86-msi", 358 | "win-x86-zip" 359 | ], 360 | "npm": "5.6.0", 361 | "v8": "6.2.414.46", 362 | "uv": "1.19.2", 363 | "zlib": "1.2.11", 364 | "openssl": "1.0.2o", 365 | "modules": "59", 366 | "lts": false, 367 | "security": false 368 | }, 369 | { 370 | "version": "v9.11.1", 371 | "date": "2018-04-05", 372 | "files": [ 373 | "aix-ppc64", 374 | "headers", 375 | "linux-arm64", 376 | "linux-armv6l", 377 | "linux-armv7l", 378 | "linux-ppc64le", 379 | "linux-s390x", 380 | "linux-x64", 381 | "linux-x86", 382 | "osx-x64-pkg", 383 | "osx-x64-tar", 384 | "src", 385 | "sunos-x64", 386 | "sunos-x86", 387 | "win-x64-7z", 388 | "win-x64-exe", 389 | "win-x64-msi", 390 | "win-x64-zip", 391 | "win-x86-7z", 392 | "win-x86-exe", 393 | "win-x86-msi", 394 | "win-x86-zip" 395 | ], 396 | "npm": "5.6.0", 397 | "v8": "6.2.414.46", 398 | "uv": "1.19.2", 399 | "zlib": "1.2.11", 400 | "openssl": "1.0.2o", 401 | "modules": "59", 402 | "lts": false, 403 | "security": false 404 | }, 405 | { 406 | "version": "v8.17.0", 407 | "date": "2019-12-17", 408 | "files": [ 409 | "aix-ppc64", 410 | "headers", 411 | "linux-arm64", 412 | "linux-armv6l", 413 | "linux-armv7l", 414 | "linux-ppc64le", 415 | "linux-s390x", 416 | "linux-x64", 417 | "linux-x86", 418 | "osx-x64-pkg", 419 | "osx-x64-tar", 420 | "src", 421 | "sunos-x64", 422 | "sunos-x86", 423 | "win-x64-7z", 424 | "win-x64-exe", 425 | "win-x64-msi", 426 | "win-x64-zip", 427 | "win-x86-7z", 428 | "win-x86-exe", 429 | "win-x86-msi", 430 | "win-x86-zip" 431 | ], 432 | "npm": "6.13.4", 433 | "v8": "6.2.414.78", 434 | "uv": "1.23.2", 435 | "zlib": "1.2.11", 436 | "openssl": "1.0.2s", 437 | "modules": "57", 438 | "lts": "Carbon", 439 | "security": true 440 | }, 441 | { 442 | "version": "v8.16.2", 443 | "date": "2019-10-08", 444 | "files": [ 445 | "aix-ppc64", 446 | "headers", 447 | "linux-arm64", 448 | "linux-armv6l", 449 | "linux-armv7l", 450 | "linux-ppc64le", 451 | "linux-s390x", 452 | "linux-x64", 453 | "linux-x86", 454 | "osx-x64-pkg", 455 | "osx-x64-tar", 456 | "src", 457 | "sunos-x64", 458 | "sunos-x86", 459 | "win-x64-7z", 460 | "win-x64-exe", 461 | "win-x64-msi", 462 | "win-x64-zip", 463 | "win-x86-7z", 464 | "win-x86-exe", 465 | "win-x86-msi", 466 | "win-x86-zip" 467 | ], 468 | "npm": "6.4.1", 469 | "v8": "6.2.414.78", 470 | "uv": "1.23.2", 471 | "zlib": "1.2.11", 472 | "openssl": "1.0.2s", 473 | "modules": "57", 474 | "lts": "Carbon", 475 | "security": false 476 | }, 477 | { 478 | "version": "v7.10.1", 479 | "date": "2017-07-11", 480 | "files": [ 481 | "aix-ppc64", 482 | "headers", 483 | "linux-arm64", 484 | "linux-armv6l", 485 | "linux-armv7l", 486 | "linux-ppc64le", 487 | "linux-s390x", 488 | "linux-x64", 489 | "linux-x86", 490 | "osx-x64-pkg", 491 | "osx-x64-tar", 492 | "src", 493 | "sunos-x64", 494 | "sunos-x86", 495 | "win-x64-7z", 496 | "win-x64-exe", 497 | "win-x64-msi", 498 | "win-x64-zip", 499 | "win-x86-7z", 500 | "win-x86-exe", 501 | "win-x86-msi", 502 | "win-x86-zip" 503 | ], 504 | "npm": "4.2.0", 505 | "v8": "5.5.372.43", 506 | "uv": "1.11.0", 507 | "zlib": "1.2.11", 508 | "openssl": "1.0.2k", 509 | "modules": "51", 510 | "lts": false, 511 | "security": true 512 | }, 513 | { 514 | "version": "v7.10.0", 515 | "date": "2017-05-02", 516 | "files": [ 517 | "aix-ppc64", 518 | "headers", 519 | "linux-arm64", 520 | "linux-armv6l", 521 | "linux-armv7l", 522 | "linux-ppc64le", 523 | "linux-s390x", 524 | "linux-x64", 525 | "linux-x86", 526 | "osx-x64-pkg", 527 | "osx-x64-tar", 528 | "src", 529 | "sunos-x64", 530 | "sunos-x86", 531 | "win-x64-7z", 532 | "win-x64-exe", 533 | "win-x64-msi", 534 | "win-x64-zip", 535 | "win-x86-7z", 536 | "win-x86-exe", 537 | "win-x86-msi", 538 | "win-x86-zip" 539 | ], 540 | "npm": "4.2.0", 541 | "v8": "5.5.372.43", 542 | "uv": "1.11.0", 543 | "zlib": "1.2.11", 544 | "openssl": "1.0.2k", 545 | "modules": "51", 546 | "lts": false, 547 | "security": false 548 | }, 549 | { 550 | "version": "v6.17.1", 551 | "date": "2019-04-03", 552 | "files": [ 553 | "aix-ppc64", 554 | "headers", 555 | "linux-arm64", 556 | "linux-armv6l", 557 | "linux-armv7l", 558 | "linux-ppc64le", 559 | "linux-s390x", 560 | "linux-x64", 561 | "linux-x86", 562 | "osx-x64-pkg", 563 | "osx-x64-tar", 564 | "src", 565 | "sunos-x64", 566 | "sunos-x86", 567 | "win-x64-7z", 568 | "win-x64-exe", 569 | "win-x64-msi", 570 | "win-x64-zip", 571 | "win-x86-7z", 572 | "win-x86-exe", 573 | "win-x86-msi", 574 | "win-x86-zip" 575 | ], 576 | "npm": "3.10.10", 577 | "v8": "5.1.281.111", 578 | "uv": "1.16.1", 579 | "zlib": "1.2.11", 580 | "openssl": "1.0.2r", 581 | "modules": "48", 582 | "lts": "Boron", 583 | "security": false 584 | }, 585 | { 586 | "version": "v6.17.0", 587 | "date": "2019-02-28", 588 | "files": [ 589 | "aix-ppc64", 590 | "headers", 591 | "linux-arm64", 592 | "linux-armv6l", 593 | "linux-armv7l", 594 | "linux-ppc64le", 595 | "linux-s390x", 596 | "linux-x64", 597 | "linux-x86", 598 | "osx-x64-pkg", 599 | "osx-x64-tar", 600 | "src", 601 | "sunos-x64", 602 | "sunos-x86", 603 | "win-x64-7z", 604 | "win-x64-exe", 605 | "win-x64-msi", 606 | "win-x64-zip", 607 | "win-x86-7z", 608 | "win-x86-exe", 609 | "win-x86-msi", 610 | "win-x86-zip" 611 | ], 612 | "npm": "3.10.10", 613 | "v8": "5.1.281.111", 614 | "uv": "1.16.1", 615 | "zlib": "1.2.11", 616 | "openssl": "1.0.2r", 617 | "modules": "48", 618 | "lts": "Boron", 619 | "security": true 620 | }, 621 | { 622 | "version": "v5.12.0", 623 | "date": "2016-06-23", 624 | "files": [ 625 | "headers", 626 | "linux-arm64", 627 | "linux-armv6l", 628 | "linux-armv7l", 629 | "linux-ppc64le", 630 | "linux-x64", 631 | "linux-x86", 632 | "osx-x64-pkg", 633 | "osx-x64-tar", 634 | "src", 635 | "sunos-x64", 636 | "sunos-x86", 637 | "win-x64-exe", 638 | "win-x64-msi", 639 | "win-x86-exe", 640 | "win-x86-msi" 641 | ], 642 | "npm": "3.8.6", 643 | "v8": "4.6.85.32", 644 | "uv": "1.8.0", 645 | "zlib": "1.2.8", 646 | "openssl": "1.0.2h", 647 | "modules": "47", 648 | "lts": false, 649 | "security": false 650 | }, 651 | { 652 | "version": "v4.9.1", 653 | "date": "2018-03-29", 654 | "files": [ 655 | "headers", 656 | "linux-arm64", 657 | "linux-armv6l", 658 | "linux-armv7l", 659 | "linux-ppc64le", 660 | "linux-x64", 661 | "linux-x86", 662 | "osx-x64-pkg", 663 | "osx-x64-tar", 664 | "src", 665 | "sunos-x64", 666 | "sunos-x86", 667 | "win-x64-7z", 668 | "win-x64-exe", 669 | "win-x64-msi", 670 | "win-x64-zip", 671 | "win-x86-7z", 672 | "win-x86-exe", 673 | "win-x86-msi", 674 | "win-x86-zip" 675 | ], 676 | "npm": "2.15.11", 677 | "v8": "4.5.103.53", 678 | "uv": "1.9.1", 679 | "zlib": "1.2.11", 680 | "openssl": "1.0.2o", 681 | "modules": "46", 682 | "lts": "Argon", 683 | "security": false 684 | }, 685 | { 686 | "version": "v4.9.0", 687 | "date": "2018-03-28", 688 | "files": [ 689 | "headers", 690 | "linux-arm64", 691 | "linux-armv6l", 692 | "linux-armv7l", 693 | "linux-ppc64le", 694 | "linux-x64", 695 | "linux-x86", 696 | "osx-x64-pkg", 697 | "osx-x64-tar", 698 | "src", 699 | "sunos-x64", 700 | "sunos-x86", 701 | "win-x64-7z", 702 | "win-x64-exe", 703 | "win-x64-msi", 704 | "win-x64-zip", 705 | "win-x86-7z", 706 | "win-x86-exe", 707 | "win-x86-msi", 708 | "win-x86-zip" 709 | ], 710 | "npm": "2.15.11", 711 | "v8": "4.5.103.53", 712 | "uv": "1.9.1", 713 | "zlib": "1.2.11", 714 | "openssl": "1.0.2o", 715 | "modules": "46", 716 | "lts": "Argon", 717 | "security": true 718 | }, 719 | { 720 | "version": "v0.12.18", 721 | "date": "2017-02-22", 722 | "files": [ 723 | "headers", 724 | "linux-x64", 725 | "linux-x86", 726 | "osx-x64-pkg", 727 | "osx-x64-tar", 728 | "osx-x86-tar", 729 | "src", 730 | "sunos-x86", 731 | "win-x64-exe", 732 | "win-x86-exe", 733 | "win-x86-msi" 734 | ], 735 | "npm": "2.15.11", 736 | "v8": "3.28.71.20", 737 | "uv": "1.6.1", 738 | "zlib": "1.2.8", 739 | "openssl": "1.0.1u", 740 | "modules": "14", 741 | "lts": false, 742 | "security": false 743 | }, 744 | { 745 | "version": "v0.12.17", 746 | "date": "2016-10-18", 747 | "files": [ 748 | "headers", 749 | "linux-x64", 750 | "linux-x86", 751 | "osx-x64-pkg", 752 | "osx-x64-tar", 753 | "osx-x86-tar", 754 | "src", 755 | "sunos-x64", 756 | "sunos-x86", 757 | "win-x64-exe", 758 | "win-x86-exe", 759 | "win-x86-msi" 760 | ], 761 | "npm": "2.15.1", 762 | "v8": "3.28.71.19", 763 | "uv": "1.6.1", 764 | "zlib": "1.2.8", 765 | "openssl": "1.0.1u", 766 | "modules": "14", 767 | "lts": false, 768 | "security": true 769 | } 770 | ] --------------------------------------------------------------------------------