Use toolkit from npmjs

This commit is contained in:
Danny McCormick 2019-08-07 14:30:47 -04:00
parent fbe402b9f6
commit 6c03e2d31c
24 changed files with 370 additions and 170 deletions

76
node_modules/@actions/core/README.md generated vendored
View File

@ -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');
}
```

View File

@ -16,11 +16,7 @@ export declare enum ExitCode {
/**
* 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
Failure = 1
}
/**
* sets env variable for this action and future actions in the job
@ -54,10 +50,6 @@ export declare function getInput(name: string, options?: InputOptions): string;
* @param value value to store
*/
export declare function setOutput(name: string, value: string): void;
/**
* Sets the action status to neutral
*/
export declare function setNeutral(): void;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1

View File

@ -15,10 +15,6 @@ var ExitCode;
* 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 = {}));
//-----------------------------------------------------------------------
// Variables
@ -80,13 +76,6 @@ exports.setOutput = setOutput;
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/**
* Sets the action status to neutral
*/
function setNeutral() {
process.exitCode = ExitCode.Neutral;
}
exports.setNeutral = setNeutral;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1

View File

@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;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,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM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",
"_id": "@actions/core@1.0.0",
"_inBundle": false,
"_integrity": "sha512-P+mC79gXC2yvyU0+RDctxKUI1Q3tNruB+aSmFI47j2H0DylxtDEgycW9WXwt/zCY62lfwfvBoGKpuJRvFHDqpw==",
"_integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
"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\\damccorm\\Documents\\node12-template\\toolkit\\actions-core-0.0.0.tgz"
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/",
"/@actions/tool-cache"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-core-0.0.0.tgz",
"_shasum": "3f3d82f209fd62dd9c01f180c963596f6c479f29",
"_spec": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz",
"_shasum": "4a090a2e958cc300b9ea802331034d5faf42d239",
"_spec": "@actions/core@^1.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\node12-template",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -40,6 +40,7 @@
"files": [
"lib"
],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
"keywords": [
"core",
@ -59,5 +60,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.0.0"
}

59
node_modules/@actions/exec/README.md generated vendored
View File

@ -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']);
```

View File

@ -1,29 +1,29 @@
{
"_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\\damccorm\\Documents\\node12-template",
"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\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz"
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/",
"/@actions/tool-cache"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-exec-0.0.0.tgz",
"_shasum": "341d868fe6c4123ded20db9c2106b7b8c16e1d73",
"_spec": "@actions/exec@file:toolkit/actions-exec-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.0.tgz",
"_shasum": "70c8b698c9baa02965c07da5f0b185ca56f0a955",
"_spec": "@actions/exec@^1.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\node12-template",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -31,7 +31,7 @@
"deprecated": false,
"description": "Actions exec lib",
"devDependencies": {
"@actions/io": "^0.0.0"
"@actions/io": "^1.0.0"
},
"directories": {
"lib": "lib",
@ -40,6 +40,7 @@
"files": [
"lib"
],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
"keywords": [
"exec",
@ -59,5 +60,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.0.0"
}

View File

@ -8,11 +8,12 @@ Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the A
```
const github = require('@actions/github');
const core = require('@actions/core');
// This should be a token with access to your repository scoped in as a secret.
const myToken = process.env.GITHUB_TOKEN
const myToken = core.getInput('myToken');
const octokit = new github.GitHub(myToken)
const octokit = new github.GitHub(myToken);
const pulls = await octokit.pulls.get({
owner: 'octokit',
@ -21,15 +22,15 @@ const pulls = await octokit.pulls.get({
mediaType: {
format: 'diff'
}
})
});
console.log(pulls)
console.log(pulls);
```
You can also make GraphQL requests:
```
const result = await octokit.graphql(query, variables)
const result = await octokit.graphql(query, variables);
```
Finally, you can get the context of the current action:
@ -37,11 +38,11 @@ Finally, you can get the context of the current action:
```
const github = require('@actions/github');
const context = github.context
const context = github.context;
const newIssue = await octokit.issues.create({
...context.repo,
title: 'New issue!',
body: 'Hello Universe!'
})
```
});
```

View File

@ -1,5 +1,7 @@
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
import Octokit from '@octokit/rest';
import * as Context from './context';
export declare const context: Context.Context;
export declare class GitHub extends Octokit {
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
constructor(token: string);

View File

@ -16,7 +16,7 @@ const rest_1 = __importDefault(require("@octokit/rest"));
const Context = __importStar(require("./context"));
// We need this in order to extend Octokit
rest_1.default.prototype = new rest_1.default();
module.exports.context = new Context.Context();
exports.context = new Context.Context();
class GitHub extends rest_1.default {
constructor(token) {
super({ auth: `token ${token}` });

View File

@ -1 +1 @@
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE9C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}

View File

@ -1,13 +1,13 @@
export interface PayloadRepository {
[key: string]: any;
fullName?: string;
full_name?: string;
name: string;
owner: {
[key: string]: any;
login: string;
name?: string;
};
htmlUrl?: string;
html_url?: string;
}
export interface WebhookPayload {
[key: string]: any;
@ -18,10 +18,10 @@ export interface WebhookPayload {
html_url?: string;
body?: string;
};
pullRequest?: {
pull_request?: {
[key: string]: any;
number: number;
htmlUrl?: string;
html_url?: string;
body?: string;
};
sender?: {

View File

@ -1,28 +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-K13pi9kbZqFnvhe8m6uqfz4kCnB4Ki6fzv4XBae1zDZfn2Si+Qx6j1pAfXSo7QI2+ZWAX/g0paFgcJsS6ZTWZA==",
"_integrity": "sha512-PPbWZ5wFAD/Vr+RCECfR3KNHjTwYln4liJBihs9tQUL0/PCFqB2lSkIh9V94AcZFHxgKk8snImjuLaBE8bKR7A==",
"_location": "/@actions/github",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
"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\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz"
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz",
"_shasum": "0764713c5b42ec9bbd9b4ca26b971dcdedadd820",
"_spec": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-1.0.0.tgz",
"_shasum": "5154cadd93c4b17217f56304ee27056730b8ae88",
"_spec": "@actions/github@^1.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\node12-template",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -43,6 +43,7 @@
"files": [
"lib"
],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
"keywords": [
"github",
@ -63,5 +64,5 @@
"test": "jest",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.0.0"
}

80
node_modules/@actions/io/README.md generated vendored
View File

@ -4,46 +4,50 @@
## Usage
#### mkdir -p
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
```
/**
* Copies a file or folder.
*
* @param source source path
* @param dest destination path
* @param options optional. See CopyOptions.
*/
export function cp(source: string, dest: string, options?: CopyOptions): Promise<void>
const io = require('@actions/io');
/**
* Remove a path recursively with force
*
* @param path path to remove
*/
export function rmRF(path: string): Promise<void>
await io.mkdirP('path/to/make');
```
/**
* Make a directory. Creates the full path with folders in between
*
* @param p path to create
* @returns Promise<void>
*/
export function mkdirP(p: string): Promise<void>
#### cp/mv
/**
* Moves a path.
*
* @param source source path
* @param dest destination path
* @param options optional. See CopyOptions.
*/
export function mv(source: string, dest: string, options?: CopyOptions): Promise<void>
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
/**
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
*
* @param tool name of the tool
* @param options optional. See WhichOptions.
* @returns Promise<string> path to tool
*/
export function which(tool: string, options?: WhichOptions): Promise<string>
```
```
const io = require('@actions/io');
// Recursive must be true for directories
const options = { recursive: true, force: false }
await io.cp('path/to/directory', 'path/to/dest', options);
await io.mv('path/to/file', 'path/to/dest');
```
#### rm -rf
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
```
const io = require('@actions/io');
await io.rmRF('path/to/directory');
await io.rmRF('path/to/file');
```
#### which
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
```
const exec = require('@actions/exec');
const io = require('@actions/io');
const pythonPath: string = await io.which('python', true)
await exec.exec(`"${pythonPath}"`, ['main.py']);
```

View File

@ -1,29 +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-BZqiiacJkzERkYIMUQWrujLZWSFHEA6bD/LzR7QSDHpx32+PPk7NaUNmt8CG+y+OlYPc/ZZGaY3368K1ppfptA==",
"_integrity": "sha512-ezrJSRdqtXtdx1WXlfYL85+40F7gB39jCK9P0jZVODW3W6xUYmu6ZOEc/UmmElUwhRyDRm1R4yNZu1Joq2kuQg==",
"_location": "/@actions/io",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
"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\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz"
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/",
"/@actions/tool-cache"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-io-0.0.0.tgz",
"_shasum": "64c85baec8d8ed889a5fb8e2ef794e36a692eeb8",
"_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.0.tgz",
"_shasum": "379454174660623bb5b3bce0be8b9e2285a62bcb",
"_spec": "@actions/io@^1.0.0",
"_where": "C:\\Users\\Administrator\\Documents\\node12-template",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
@ -37,6 +37,7 @@
"files": [
"lib"
],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
"keywords": [
"io",
@ -56,5 +57,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.0.0"
}

View File

@ -4,4 +4,79 @@
## Usage
See [src/tool-cache.ts](src/tool-cache.ts).
#### Download
You can use this to download tools (or other files) from a download URL:
```
const tc = require('@actions/tool-cache');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
```
#### Extract
These can then be extracted in platform specific ways:
```
const tc = require('@actions/tool-cache');
if (process.platform === 'win32') {
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
// Or alternately
tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
}
else {
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
}
```
#### Cache
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
You'll often want to add it to the path as part of this step:
```
const tc = require('@actions/tool-cache');
const core = require('@actions/core');
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
core.addPath(cachedPath);
```
You can also cache files for reuse.
```
const tc = require('@actions/tool-cache');
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
```
#### Find
Finally, you can find directories and files you've previously cached:
```
const tc = require('@actions/tool-cache');
const core = require('@actions/core');
const nodeDirectory = tc.find('node', '12.x', 'x64');
core.addPath(nodeDirectory);
```
You can even find all cached versions of a tool:
```
const tc = require('@actions/tool-cache');
const allNodeVersions = tc.findAllVersions('node');
console.log(`Versions of node available: ${allNodeVersions}`);
```

View File

@ -1,36 +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-CCJjXKGfqR34oo1mgKpUk63g3fcoIq+aNJBZ7b73aWGot0ddju2cefJrKjhEun4FI7gYsLYg+ayAUnbFwkGd4Q==",
"_integrity": "sha512-l3zT0IfDfi5Ik5aMpnXqGHGATxN8xa9ls4ue+X/CBXpPhRMRZS4vcuh5Q9T98WAGbkysRCfhpbksTPHIcKnNwQ==",
"_location": "/@actions/tool-cache",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
"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\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz"
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-tool-cache-0.0.0.tgz",
"_shasum": "223a115ab2782ba0a7ad4a0a829030b9cb84eade",
"_spec": "@actions/tool-cache@file:toolkit/actions-tool-cache-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_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\\Administrator\\Documents\\node12-template",
"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"
@ -51,6 +51,7 @@
"lib",
"scripts"
],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
"keywords": [
"exec",
@ -70,5 +71,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.0.0"
}

31
package-lock.json generated
View File

@ -5,32 +5,37 @@
"requires": true,
"dependencies": {
"@actions/core": {
"version": "file:toolkit/actions-core-0.0.0.tgz",
"integrity": "sha512-P+mC79gXC2yvyU0+RDctxKUI1Q3tNruB+aSmFI47j2H0DylxtDEgycW9WXwt/zCY62lfwfvBoGKpuJRvFHDqpw=="
"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=="
"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-K13pi9kbZqFnvhe8m6uqfz4kCnB4Ki6fzv4XBae1zDZfn2Si+Qx6j1pAfXSo7QI2+ZWAX/g0paFgcJsS6ZTWZA==",
"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-BZqiiacJkzERkYIMUQWrujLZWSFHEA6bD/LzR7QSDHpx32+PPk7NaUNmt8CG+y+OlYPc/ZZGaY3368K1ppfptA=="
"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-CCJjXKGfqR34oo1mgKpUk63g3fcoIq+aNJBZ7b73aWGot0ddju2cefJrKjhEun4FI7gYsLYg+ayAUnbFwkGd4Q==",
"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"

View File

@ -22,11 +22,11 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
"@actions/github": "file:toolkit/actions-github-0.0.0.tgz",
"@actions/tool-cache": "file:toolkit/actions-tool-cache-0.0.0.tgz",
"@actions/core": "^1.0.0",
"@actions/io": "^1.0.0",
"@actions/exec": "^1.0.0",
"@actions/github": "^1.0.0",
"@actions/tool-cache": "^1.0.0",
"semver": "^6.1.1"
},
"devDependencies": {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.