parent
5273d0df9c
commit
8de2f9fcbc
12
README.md
12
README.md
|
@ -1,5 +1,9 @@
|
|||
# setup-node
|
||||
|
||||
<p align="left">
|
||||
<a href="https://github.com/actions/setup-node"><img alt="GitHub Actions status" src="https://github.com/actions/setup-node/workflows/Main%20workflow/badge.svg"></a>
|
||||
</p>
|
||||
|
||||
This action sets by node environment for use in actions by:
|
||||
|
||||
- optionally downloading and caching a version of node - npm by version spec and add to PATH
|
||||
|
@ -15,7 +19,7 @@ steps:
|
|||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
version: '10.x'
|
||||
node-version: '10.x'
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
@ -34,7 +38,7 @@ jobs:
|
|||
- name: Setup node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
version: ${{ matrix.node }}
|
||||
node-version: ${{ matrix.node }}
|
||||
- run: npm install
|
||||
- run: npm test
|
||||
```
|
||||
|
@ -45,7 +49,7 @@ steps:
|
|||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
version: '10.x'
|
||||
node-version: '10.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- run: npm install
|
||||
- run: npm publish
|
||||
|
@ -65,7 +69,7 @@ steps:
|
|||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
version: '10.x'
|
||||
node-version: '10.x'
|
||||
registry-url: <registry url>
|
||||
- run: npm install -g yarn
|
||||
- run: yarn install
|
||||
|
|
|
@ -7,12 +7,12 @@ registry=https://registry.npmjs.org/"
|
|||
|
||||
exports[`installer tests Automatically configures GPR scope 1`] = `
|
||||
"npm.pkg.github.com/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
@owner:registry=npm.pkg.github.com/"
|
||||
@ownername:registry=npm.pkg.github.com/"
|
||||
`;
|
||||
|
||||
exports[`installer tests Configures scoped npm registries 1`] = `
|
||||
"//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}
|
||||
@myScope:registry=https://registry.npmjs.org/"
|
||||
@myscope:registry=https://registry.npmjs.org/"
|
||||
`;
|
||||
|
||||
exports[`installer tests Sets up npmrc for npmjs 1`] = `
|
||||
|
|
|
@ -15,7 +15,7 @@ const tempDir = path.join(
|
|||
|
||||
const rcFile = path.join(tempDir, '.npmrc');
|
||||
|
||||
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
|
||||
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
import * as auth from '../src/authutil';
|
||||
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
name: 'Setup Node.js for use with actions'
|
||||
name: 'Setup Node.js environment'
|
||||
description: 'Setup a Node.js environment and add it to the PATH, additionally providing proxy support'
|
||||
author: 'GitHub'
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0, lts'
|
||||
node-version:
|
||||
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
|
||||
default: '10.x'
|
||||
registry-url:
|
||||
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'
|
||||
scope:
|
||||
description: 'Optional scope for authenticating against scoped registries'
|
||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
||||
version:
|
||||
description: 'Deprecated. Use node-version instead. Will not be supported after October 1, 2019'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'lib/setup-node.js'
|
||||
|
|
|
@ -28,6 +28,9 @@ function writeRegistryToFile(registryUrl, fileLocation) {
|
|||
if (scope && scope[0] != '@') {
|
||||
scope = '@' + scope;
|
||||
}
|
||||
if (scope) {
|
||||
scope = scope.toLowerCase();
|
||||
}
|
||||
core.debug(`Setting auth in ${fileLocation}`);
|
||||
let newContents = '';
|
||||
if (fs.existsSync(fileLocation)) {
|
||||
|
|
|
@ -103,7 +103,7 @@ function queryLatestMatch(versionSpec) {
|
|||
}
|
||||
let versions = [];
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let rest = new restm.RestClient('vsts-node-tool');
|
||||
let rest = new restm.RestClient('setup-node');
|
||||
let nodeVersions = (yield rest.get(dataUrl)).result || [];
|
||||
nodeVersions.forEach((nodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
|
|
|
@ -26,7 +26,10 @@ function run() {
|
|||
// Version is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||
//
|
||||
const version = core.getInput('version');
|
||||
let version = core.getInput('version');
|
||||
if (!version) {
|
||||
version = core.getInput('node-version');
|
||||
}
|
||||
if (version) {
|
||||
// TODO: installer doesn't support proxy
|
||||
yield installer.getNode(version);
|
||||
|
|
|
@ -4,4 +4,78 @@
|
|||
|
||||
## Usage
|
||||
|
||||
See [src/core.ts](src/core.ts).
|
||||
#### Inputs/Outputs
|
||||
|
||||
You can use this library to get inputs or set outputs:
|
||||
|
||||
```
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
// Do stuff
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables/secrets
|
||||
|
||||
You can also export variables and secrets for future steps. Variables get set in the environment automatically, while secrets must be scoped into the environment from a workflow using `{{ secret.FOO }}`. Secrets will also be masked from the logs:
|
||||
|
||||
```
|
||||
const core = require('@actions/core');
|
||||
|
||||
// Do stuff
|
||||
|
||||
core.exportVariable('envVar', 'Val');
|
||||
core.exportSecret('secretVar', variableWithSecretValue);
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||
|
||||
```
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.addPath('pathToTool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action:
|
||||
|
||||
```
|
||||
const core = require('@actions/core');
|
||||
|
||||
try {
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
// setFailed logs the message and sets a failing exit code
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
Finally, this library provides some utilities for logging:
|
||||
|
||||
```
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('input');
|
||||
try {
|
||||
core.debug('Inside try block');
|
||||
|
||||
if (!myInput) {
|
||||
core.warning('myInput wasnt set');
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
core.error('Error ${err}, action may still succeed though');
|
||||
}
|
||||
```
|
||||
|
|
|
@ -5,6 +5,19 @@ export interface InputOptions {
|
|||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
|
@ -31,9 +44,12 @@ export declare function addPath(inputPath: string): void;
|
|||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
*/
|
||||
export declare function setNeutral(): void;
|
||||
export declare function setOutput(name: string, value: string): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const exit_1 = require("@actions/exit");
|
||||
const command_1 = require("./command");
|
||||
const path = require("path");
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -50,23 +63,26 @@ function getInput(name, options) {
|
|||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store
|
||||
*/
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to neutral
|
||||
*/
|
||||
function setNeutral() {
|
||||
process.exitCode = exit_1.ExitCode.Neutral;
|
||||
}
|
||||
exports.setNeutral = setNeutral;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = exit_1.ExitCode.Failure;
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,wCAAsC;AACtC,uCAA6C;AAE7C,6BAA4B;AAU5B,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CA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pC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC"}
|
|
@ -1,36 +1,33 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"_id": "@actions/core@0.0.0",
|
||||
"_from": "@actions/core@^1.0.0",
|
||||
"_id": "@actions/core@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
||||
"_integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@^1.0.0",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-core-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-core-0.0.0.tgz"
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-core-0.0.0.tgz",
|
||||
"_shasum": "346d90a534fa6c5021bc2e1b732574fd2c66fc35",
|
||||
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
|
||||
"_shasum": "4a090a2e958cc300b9ea802331034d5faf42d239",
|
||||
"_spec": "@actions/core@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/exit": "^0.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
|
@ -43,6 +40,7 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"keywords": [
|
||||
"core",
|
||||
|
@ -62,5 +60,5 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,7 +1,60 @@
|
|||
# `@actions/exec`
|
||||
|
||||
> Functions necessary for running tools on the command line
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/exec.ts](src/exec.ts).
|
||||
#### Basic
|
||||
|
||||
You can use this package to execute your tools on the command line in a cross platform way:
|
||||
|
||||
```
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node index.js');
|
||||
```
|
||||
|
||||
#### Args
|
||||
|
||||
You can also pass in arg arrays:
|
||||
|
||||
```
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||
```
|
||||
|
||||
#### Output/options
|
||||
|
||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||
|
||||
```
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
const myOutput = '';
|
||||
const myError = '';
|
||||
|
||||
const options = {};
|
||||
options.listeners = {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myError += data.toString();
|
||||
}
|
||||
};
|
||||
options.cwd = './lib';
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||
```
|
||||
|
||||
#### Exec tools not in the PATH
|
||||
|
||||
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
||||
|
||||
```
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
```
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_id": "@actions/exec@0.0.0",
|
||||
"_from": "@actions/exec@^1.0.0",
|
||||
"_id": "@actions/exec@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A==",
|
||||
"_integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/exec@^1.0.0",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exec-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-exec-0.0.0.tgz"
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-exec-0.0.0.tgz",
|
||||
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
|
||||
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
|
||||
"_shasum": "70c8b698c9baa02965c07da5f0b185ca56f0a955",
|
||||
"_spec": "@actions/exec@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node\\node_modules\\@actions\\tool-cache",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
@ -31,7 +30,7 @@
|
|||
"deprecated": false,
|
||||
"description": "Actions exec lib",
|
||||
"devDependencies": {
|
||||
"@actions/io": "^0.0.0"
|
||||
"@actions/io": "^1.0.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
|
@ -40,6 +39,7 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"exec",
|
||||
|
@ -59,5 +59,5 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# `@actions/exit`
|
||||
|
||||
> TODO: description
|
||||
|
||||
## Usage
|
||||
|
||||
See [src/exit.ts](src/exit.ts).
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1,
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
Neutral = 78
|
||||
}
|
||||
/**
|
||||
* Exit the action as a success.
|
||||
*/
|
||||
export declare function success(): void;
|
||||
/**
|
||||
* Exit the action as a failure.
|
||||
*/
|
||||
export declare function failure(): void;
|
||||
/**
|
||||
* Exit the action neither a success or a failure
|
||||
*/
|
||||
export declare function neutral(): void;
|
|
@ -1,44 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
/**
|
||||
* A code indicating that the action is complete, but neither succeeded nor failed
|
||||
*/
|
||||
ExitCode[ExitCode["Neutral"] = 78] = "Neutral";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
// TODO: These exit codes may not behave as expected on the new runtime, due to
|
||||
// complexities of async logging and sync exiting.
|
||||
/**
|
||||
* Exit the action as a success.
|
||||
*/
|
||||
function success() {
|
||||
process.exit(ExitCode.Success);
|
||||
}
|
||||
exports.success = success;
|
||||
/**
|
||||
* Exit the action as a failure.
|
||||
*/
|
||||
function failure() {
|
||||
process.exit(ExitCode.Failure);
|
||||
}
|
||||
exports.failure = failure;
|
||||
/**
|
||||
* Exit the action neither a success or a failure
|
||||
*/
|
||||
function neutral() {
|
||||
process.exit(ExitCode.Neutral);
|
||||
}
|
||||
exports.neutral = neutral;
|
||||
//# sourceMappingURL=exit.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../src/exit.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,8CAAY,CAAA;AACd,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB;AAED,+EAA+E;AAC/E,kDAAkD;AAElD;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC;AAED;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;AAChC,CAAC;AAFD,0BAEC"}
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-exit-0.0.0.tgz",
|
||||
"_id": "@actions/exit@0.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-vQdxFWM0/AERkC79mQ886SqPmV4joWhrSF7hiSTiJoKkE9eTjrKV5WQtp7SXv6OntrQkKX+ZjgdGpv+0rvJRCw==",
|
||||
"_location": "/@actions/exit",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/exit@file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"name": "@actions/exit",
|
||||
"escapedName": "@actions%2fexit",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-exit-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-exit-0.0.0.tgz"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/core"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-exit-0.0.0.tgz",
|
||||
"_shasum": "d47c8c61b45750ae49fea3061e3419a547b2a48f",
|
||||
"_spec": "@actions/exit@file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Functions for safely exiting from GitHub Actions",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exit",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"toolkit"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/exit.js",
|
||||
"name": "@actions/exit",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,29 +1,28 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-github-0.0.0.tgz",
|
||||
"_id": "@actions/github@0.0.0",
|
||||
"_from": "@actions/github@^1.0.0",
|
||||
"_id": "@actions/github@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CByX5VIagC5BqGwsHD9Qt5MfN+H6GDC9qQl+MIUipaHTc89sUG/vAY/xQDS9vxuuRwrxbdERwKO3dR6U1BSziw==",
|
||||
"_integrity": "sha512-PPbWZ5wFAD/Vr+RCECfR3KNHjTwYln4liJBihs9tQUL0/PCFqB2lSkIh9V94AcZFHxgKk8snImjuLaBE8bKR7A==",
|
||||
"_location": "/@actions/github",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/github@^1.0.0",
|
||||
"name": "@actions/github",
|
||||
"escapedName": "@actions%2fgithub",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-github-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-github-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-github-0.0.0.tgz"
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-github-0.0.0.tgz",
|
||||
"_shasum": "d9a87b3682d66d032fffcaff1adcdb2decd92b81",
|
||||
"_spec": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-1.0.0.tgz",
|
||||
"_shasum": "5154cadd93c4b17217f56304ee27056730b8ae88",
|
||||
"_spec": "@actions/github@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
@ -44,6 +43,7 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
|
||||
"keywords": [
|
||||
"github",
|
||||
|
@ -64,5 +64,5 @@
|
|||
"test": "jest",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,30 +1,29 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"_id": "@actions/io@0.0.0",
|
||||
"_from": "@actions/io@^1.0.0",
|
||||
"_id": "@actions/io@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MZUGyOe6m26Ns6ZQnr2JvxXzlwZ33XWYG392b5YuPMim1CE8DbuiBHtqOZeHVm5PenS4fRUG3qMTiMymve1DUA==",
|
||||
"_integrity": "sha512-ezrJSRdqtXtdx1WXlfYL85+40F7gB39jCK9P0jZVODW3W6xUYmu6ZOEc/UmmElUwhRyDRm1R4yNZu1Joq2kuQg==",
|
||||
"_location": "/@actions/io",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/io@^1.0.0",
|
||||
"name": "@actions/io",
|
||||
"escapedName": "@actions%2fio",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-io-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz"
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz",
|
||||
"_shasum": "b9fd92bae7bfb507c75e3e35a107750901a51d00",
|
||||
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz",
|
||||
"_shasum": "379454174660623bb5b3bce0be8b9e2285a62bcb",
|
||||
"_spec": "@actions/io@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
|
@ -38,6 +37,7 @@
|
|||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
||||
"keywords": [
|
||||
"io",
|
||||
|
@ -57,5 +57,5 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,37 +1,36 @@
|
|||
{
|
||||
"_from": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_id": "@actions/tool-cache@0.0.0",
|
||||
"_from": "@actions/tool-cache@^1.0.0",
|
||||
"_id": "@actions/tool-cache@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-33oYAVRdp6MWNT7Yca0//SmOsvpE7FpFfNA/LzwjIZdLucHaO6V67dqZ5p81CTBncrZal+O5kE9B8qSk0rhipg==",
|
||||
"_integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "file",
|
||||
"where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"raw": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/tool-cache@^1.0.0",
|
||||
"name": "@actions/tool-cache",
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"saveSpec": "file:toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"fetchSpec": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz"
|
||||
"rawSpec": "^1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "C:\\Users\\Administrator\\Documents\\setup-node\\toolkit\\actions-tool-cache-0.0.0.tgz",
|
||||
"_shasum": "ce9e7d81ebb138911d20b9f74c8aa6120caac9b1",
|
||||
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"_where": "C:\\Users\\Administrator\\Documents\\setup-node",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
||||
"_shasum": "a9ac414bd2e0bf1f5f0302f029193c418d344c09",
|
||||
"_spec": "@actions/tool-cache@^1.0.0",
|
||||
"_where": "C:\\Users\\damccorm\\Documents\\setup-node",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^0.0.0",
|
||||
"@actions/exec": "^0.0.0",
|
||||
"@actions/io": "^0.0.0",
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
|
@ -52,6 +51,7 @@
|
|||
"lib",
|
||||
"scripts"
|
||||
],
|
||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"exec",
|
||||
|
@ -71,5 +71,5 @@
|
|||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
"version": "1.0.0"
|
||||
}
|
||||
|
|
|
@ -5,39 +5,37 @@
|
|||
"requires": true,
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"integrity": "sha512-58ituSV1rzBMmmsWoFDnrnsT+Wm4kD/u9NgAGbPvZ7rQHWluYtD5bDbIsjDC6rKFuhqytkxDJPsF/TWBdgc/nA==",
|
||||
"requires": {
|
||||
"@actions/exit": "^0.0.0"
|
||||
}
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
|
||||
"integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA=="
|
||||
},
|
||||
"@actions/exec": {
|
||||
"version": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"integrity": "sha512-HHObusC4p1RElxIlrrN0sY/cweBYl+jKm3J/XWHPQZMipgJXB/dkVhUfl4KqH3Vim7oM2KjCGSfn+vTYrqVH3A=="
|
||||
},
|
||||
"@actions/exit": {
|
||||
"version": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"integrity": "sha512-vQdxFWM0/AERkC79mQ886SqPmV4joWhrSF7hiSTiJoKkE9eTjrKV5WQtp7SXv6OntrQkKX+ZjgdGpv+0rvJRCw=="
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
|
||||
"integrity": "sha512-nquH0+XKng+Ll7rZfCojN7NWSbnGh+ltwUJhzfbLkmOJgxocGX2/yXcZLMyT9fa7+tByEow/NSTrBExNlEj9fw=="
|
||||
},
|
||||
"@actions/github": {
|
||||
"version": "file:toolkit/actions-github-0.0.0.tgz",
|
||||
"integrity": "sha512-CByX5VIagC5BqGwsHD9Qt5MfN+H6GDC9qQl+MIUipaHTc89sUG/vAY/xQDS9vxuuRwrxbdERwKO3dR6U1BSziw==",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-1.0.0.tgz",
|
||||
"integrity": "sha512-PPbWZ5wFAD/Vr+RCECfR3KNHjTwYln4liJBihs9tQUL0/PCFqB2lSkIh9V94AcZFHxgKk8snImjuLaBE8bKR7A==",
|
||||
"requires": {
|
||||
"@octokit/graphql": "^2.0.1",
|
||||
"@octokit/rest": "^16.15.0"
|
||||
}
|
||||
},
|
||||
"@actions/io": {
|
||||
"version": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"integrity": "sha512-MZUGyOe6m26Ns6ZQnr2JvxXzlwZ33XWYG392b5YuPMim1CE8DbuiBHtqOZeHVm5PenS4fRUG3qMTiMymve1DUA=="
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz",
|
||||
"integrity": "sha512-ezrJSRdqtXtdx1WXlfYL85+40F7gB39jCK9P0jZVODW3W6xUYmu6ZOEc/UmmElUwhRyDRm1R4yNZu1Joq2kuQg=="
|
||||
},
|
||||
"@actions/tool-cache": {
|
||||
"version": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"integrity": "sha512-33oYAVRdp6MWNT7Yca0//SmOsvpE7FpFfNA/LzwjIZdLucHaO6V67dqZ5p81CTBncrZal+O5kE9B8qSk0rhipg==",
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.0.0.tgz",
|
||||
"integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
|
||||
"requires": {
|
||||
"@actions/core": "^0.0.0",
|
||||
"@actions/exec": "^0.0.0",
|
||||
"@actions/io": "^0.0.0",
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/exec": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
|
@ -1885,7 +1883,8 @@
|
|||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
|
@ -1906,12 +1905,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -1926,17 +1927,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2053,7 +2057,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
@ -2065,6 +2070,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
@ -2079,6 +2085,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
@ -2086,12 +2093,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
@ -2110,6 +2119,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
@ -2190,7 +2200,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -2202,6 +2213,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -2287,7 +2299,8 @@
|
|||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
|
@ -2323,6 +2336,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
@ -2342,6 +2356,7 @@
|
|||
"version": "3.0.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
|
@ -2385,12 +2400,14 @@
|
|||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
11
package.json
11
package.json
|
@ -22,12 +22,11 @@
|
|||
"author": "GitHub",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
|
||||
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
|
||||
"@actions/exit": "file:toolkit/actions-exit-0.0.0.tgz",
|
||||
"@actions/github": "file:toolkit/actions-github-0.0.0.tgz",
|
||||
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
|
||||
"@actions/tool-cache": "file:toolkit/actions-tool-cache-0.0.0.tgz",
|
||||
"@actions/core": "^1.0.0",
|
||||
"@actions/github": "^1.0.0",
|
||||
"@actions/io": "^1.0.0",
|
||||
"@actions/tool-cache": "^1.0.0",
|
||||
"typed-rest-client": "^1.5.0",
|
||||
"semver": "^6.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -24,6 +24,9 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
|
|||
if (scope && scope[0] != '@') {
|
||||
scope = '@' + scope;
|
||||
}
|
||||
if (scope) {
|
||||
scope = scope.toLowerCase();
|
||||
}
|
||||
|
||||
core.debug(`Setting auth in ${fileLocation}`);
|
||||
let newContents: string = '';
|
||||
|
|
|
@ -100,7 +100,7 @@ async function queryLatestMatch(versionSpec: string): Promise<string> {
|
|||
|
||||
let versions: string[] = [];
|
||||
let dataUrl = 'https://nodejs.org/dist/index.json';
|
||||
let rest: restm.RestClient = new restm.RestClient('vsts-node-tool');
|
||||
let rest: restm.RestClient = new restm.RestClient('setup-node');
|
||||
let nodeVersions: INodeVersion[] =
|
||||
(await rest.get<INodeVersion[]>(dataUrl)).result || [];
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
|
|
|
@ -9,7 +9,10 @@ async function run() {
|
|||
// Version is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
||||
//
|
||||
const version = core.getInput('version');
|
||||
let version = core.getInput('version');
|
||||
if (!version) {
|
||||
version = core.getInput('node-version');
|
||||
}
|
||||
if (version) {
|
||||
// TODO: installer doesn't support proxy
|
||||
await installer.getNode(version);
|
||||
|
|
Loading…
Reference in New Issue