@actions/core 1.2.2 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +9 -0
- package/README.md +8 -1
- package/lib/command.d.ts +2 -2
- package/lib/command.js +3 -2
- package/lib/command.js.map +1 -1
- package/lib/core.d.ts +21 -11
- package/lib/core.js +46 -10
- package/lib/core.js.map +1 -1
- package/lib/file-command.d.ts +1 -0
- package/lib/file-command.js +29 -0
- package/lib/file-command.js.map +1 -0
- package/lib/utils.d.ts +5 -0
- package/lib/utils.js +19 -0
- package/lib/utils.js.map +1 -0
- package/package.json +5 -4
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2019 GitHub
|
|
4
|
+
|
|
5
|
+
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:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
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.
|
package/README.md
CHANGED
|
@@ -82,7 +82,14 @@ try {
|
|
|
82
82
|
core.warning('myInput was not set');
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
if (core.isDebug()) {
|
|
86
|
+
// curl -v https://github.com
|
|
87
|
+
} else {
|
|
88
|
+
// curl https://github.com
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
// Do stuff
|
|
92
|
+
core.info('Output to the actions build log')
|
|
86
93
|
}
|
|
87
94
|
catch (err) {
|
|
88
95
|
core.error(`Error ${err}, action may still succeed though`);
|
|
@@ -137,4 +144,4 @@ const core = require('@actions/core');
|
|
|
137
144
|
var pid = core.getState("pidToKill");
|
|
138
145
|
|
|
139
146
|
process.kill(pid);
|
|
140
|
-
```
|
|
147
|
+
```
|
package/lib/command.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
interface CommandProperties {
|
|
2
|
-
[key: string]:
|
|
2
|
+
[key: string]: any;
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* Commands
|
|
@@ -11,6 +11,6 @@ interface CommandProperties {
|
|
|
11
11
|
* ::warning::This is the message
|
|
12
12
|
* ::set-env name=MY_VAR::some value
|
|
13
13
|
*/
|
|
14
|
-
export declare function issueCommand(command: string, properties: CommandProperties, message:
|
|
14
|
+
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
|
15
15
|
export declare function issue(name: string, message?: string): void;
|
|
16
16
|
export {};
|
package/lib/command.js
CHANGED
|
@@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const os = __importStar(require("os"));
|
|
11
|
+
const utils_1 = require("./utils");
|
|
11
12
|
/**
|
|
12
13
|
* Commands
|
|
13
14
|
*
|
|
@@ -62,13 +63,13 @@ class Command {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
function escapeData(s) {
|
|
65
|
-
return (s
|
|
66
|
+
return utils_1.toCommandValue(s)
|
|
66
67
|
.replace(/%/g, '%25')
|
|
67
68
|
.replace(/\r/g, '%0D')
|
|
68
69
|
.replace(/\n/g, '%0A');
|
|
69
70
|
}
|
|
70
71
|
function escapeProperty(s) {
|
|
71
|
-
return (s
|
|
72
|
+
return utils_1.toCommandValue(s)
|
|
72
73
|
.replace(/%/g, '%25')
|
|
73
74
|
.replace(/\r/g, '%0D')
|
|
74
75
|
.replace(/\n/g, '%0A')
|
package/lib/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM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,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
package/lib/core.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare enum ExitCode {
|
|
|
21
21
|
/**
|
|
22
22
|
* Sets env variable for this action and future actions in the job
|
|
23
23
|
* @param name the name of the variable to set
|
|
24
|
-
* @param val the value of the variable
|
|
24
|
+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
25
25
|
*/
|
|
26
|
-
export declare function exportVariable(name: string, val:
|
|
26
|
+
export declare function exportVariable(name: string, val: any): void;
|
|
27
27
|
/**
|
|
28
28
|
* Registers a secret which will get masked from logs
|
|
29
29
|
* @param secret value of the secret
|
|
@@ -46,15 +46,25 @@ export declare function getInput(name: string, options?: InputOptions): string;
|
|
|
46
46
|
* Sets the value of an output.
|
|
47
47
|
*
|
|
48
48
|
* @param name name of the output to set
|
|
49
|
-
* @param value value to store
|
|
49
|
+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
50
50
|
*/
|
|
51
|
-
export declare function setOutput(name: string, value:
|
|
51
|
+
export declare function setOutput(name: string, value: any): void;
|
|
52
|
+
/**
|
|
53
|
+
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
54
|
+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
export declare function setCommandEcho(enabled: boolean): void;
|
|
52
58
|
/**
|
|
53
59
|
* Sets the action status to failed.
|
|
54
60
|
* When the action exits it will be with an exit code of 1
|
|
55
61
|
* @param message add error issue message
|
|
56
62
|
*/
|
|
57
|
-
export declare function setFailed(message: string): void;
|
|
63
|
+
export declare function setFailed(message: string | Error): void;
|
|
64
|
+
/**
|
|
65
|
+
* Gets whether Actions Step Debug is on or not
|
|
66
|
+
*/
|
|
67
|
+
export declare function isDebug(): boolean;
|
|
58
68
|
/**
|
|
59
69
|
* Writes debug message to user log
|
|
60
70
|
* @param message debug message
|
|
@@ -62,14 +72,14 @@ export declare function setFailed(message: string): void;
|
|
|
62
72
|
export declare function debug(message: string): void;
|
|
63
73
|
/**
|
|
64
74
|
* Adds an error issue
|
|
65
|
-
* @param message error issue message
|
|
75
|
+
* @param message error issue message. Errors will be converted to string via toString()
|
|
66
76
|
*/
|
|
67
|
-
export declare function error(message: string): void;
|
|
77
|
+
export declare function error(message: string | Error): void;
|
|
68
78
|
/**
|
|
69
79
|
* Adds an warning issue
|
|
70
|
-
* @param message warning issue message
|
|
80
|
+
* @param message warning issue message. Errors will be converted to string via toString()
|
|
71
81
|
*/
|
|
72
|
-
export declare function warning(message: string): void;
|
|
82
|
+
export declare function warning(message: string | Error): void;
|
|
73
83
|
/**
|
|
74
84
|
* Writes info to log with console.log.
|
|
75
85
|
* @param message info message
|
|
@@ -100,9 +110,9 @@ export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>
|
|
|
100
110
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
101
111
|
*
|
|
102
112
|
* @param name name of the state to store
|
|
103
|
-
* @param value value to store
|
|
113
|
+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
104
114
|
*/
|
|
105
|
-
export declare function saveState(name: string, value:
|
|
115
|
+
export declare function saveState(name: string, value: any): void;
|
|
106
116
|
/**
|
|
107
117
|
* Gets the value of an state set by this action's main execution.
|
|
108
118
|
*
|
package/lib/core.js
CHANGED
|
@@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
const command_1 = require("./command");
|
|
20
|
+
const file_command_1 = require("./file-command");
|
|
21
|
+
const utils_1 = require("./utils");
|
|
20
22
|
const os = __importStar(require("os"));
|
|
21
23
|
const path = __importStar(require("path"));
|
|
22
24
|
/**
|
|
@@ -39,11 +41,21 @@ var ExitCode;
|
|
|
39
41
|
/**
|
|
40
42
|
* Sets env variable for this action and future actions in the job
|
|
41
43
|
* @param name the name of the variable to set
|
|
42
|
-
* @param val the value of the variable
|
|
44
|
+
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
|
43
45
|
*/
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
47
|
function exportVariable(name, val) {
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const convertedVal = utils_1.toCommandValue(val);
|
|
49
|
+
process.env[name] = convertedVal;
|
|
50
|
+
const filePath = process.env['GITHUB_ENV'] || '';
|
|
51
|
+
if (filePath) {
|
|
52
|
+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
|
53
|
+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
|
54
|
+
file_command_1.issueCommand('ENV', commandValue);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
command_1.issueCommand('set-env', { name }, convertedVal);
|
|
58
|
+
}
|
|
47
59
|
}
|
|
48
60
|
exports.exportVariable = exportVariable;
|
|
49
61
|
/**
|
|
@@ -59,7 +71,13 @@ exports.setSecret = setSecret;
|
|
|
59
71
|
* @param inputPath
|
|
60
72
|
*/
|
|
61
73
|
function addPath(inputPath) {
|
|
62
|
-
|
|
74
|
+
const filePath = process.env['GITHUB_PATH'] || '';
|
|
75
|
+
if (filePath) {
|
|
76
|
+
file_command_1.issueCommand('PATH', inputPath);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
command_1.issueCommand('add-path', {}, inputPath);
|
|
80
|
+
}
|
|
63
81
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
64
82
|
}
|
|
65
83
|
exports.addPath = addPath;
|
|
@@ -82,12 +100,22 @@ exports.getInput = getInput;
|
|
|
82
100
|
* Sets the value of an output.
|
|
83
101
|
*
|
|
84
102
|
* @param name name of the output to set
|
|
85
|
-
* @param value value to store
|
|
103
|
+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
86
104
|
*/
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
106
|
function setOutput(name, value) {
|
|
88
107
|
command_1.issueCommand('set-output', { name }, value);
|
|
89
108
|
}
|
|
90
109
|
exports.setOutput = setOutput;
|
|
110
|
+
/**
|
|
111
|
+
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
|
112
|
+
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
function setCommandEcho(enabled) {
|
|
116
|
+
command_1.issue('echo', enabled ? 'on' : 'off');
|
|
117
|
+
}
|
|
118
|
+
exports.setCommandEcho = setCommandEcho;
|
|
91
119
|
//-----------------------------------------------------------------------
|
|
92
120
|
// Results
|
|
93
121
|
//-----------------------------------------------------------------------
|
|
@@ -104,6 +132,13 @@ exports.setFailed = setFailed;
|
|
|
104
132
|
//-----------------------------------------------------------------------
|
|
105
133
|
// Logging Commands
|
|
106
134
|
//-----------------------------------------------------------------------
|
|
135
|
+
/**
|
|
136
|
+
* Gets whether Actions Step Debug is on or not
|
|
137
|
+
*/
|
|
138
|
+
function isDebug() {
|
|
139
|
+
return process.env['RUNNER_DEBUG'] === '1';
|
|
140
|
+
}
|
|
141
|
+
exports.isDebug = isDebug;
|
|
107
142
|
/**
|
|
108
143
|
* Writes debug message to user log
|
|
109
144
|
* @param message debug message
|
|
@@ -114,18 +149,18 @@ function debug(message) {
|
|
|
114
149
|
exports.debug = debug;
|
|
115
150
|
/**
|
|
116
151
|
* Adds an error issue
|
|
117
|
-
* @param message error issue message
|
|
152
|
+
* @param message error issue message. Errors will be converted to string via toString()
|
|
118
153
|
*/
|
|
119
154
|
function error(message) {
|
|
120
|
-
command_1.issue('error', message);
|
|
155
|
+
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
|
121
156
|
}
|
|
122
157
|
exports.error = error;
|
|
123
158
|
/**
|
|
124
159
|
* Adds an warning issue
|
|
125
|
-
* @param message warning issue message
|
|
160
|
+
* @param message warning issue message. Errors will be converted to string via toString()
|
|
126
161
|
*/
|
|
127
162
|
function warning(message) {
|
|
128
|
-
command_1.issue('warning', message);
|
|
163
|
+
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
|
129
164
|
}
|
|
130
165
|
exports.warning = warning;
|
|
131
166
|
/**
|
|
@@ -183,8 +218,9 @@ exports.group = group;
|
|
|
183
218
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
184
219
|
*
|
|
185
220
|
* @param name name of the state to store
|
|
186
|
-
* @param value value to store
|
|
221
|
+
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
|
187
222
|
*/
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
188
224
|
function saveState(name, value) {
|
|
189
225
|
command_1.issueCommand('save-state', { name }, value);
|
|
190
226
|
}
|
package/lib/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAAsC;AAEtC,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC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
|
|
|
1
|
+
export declare function issueCommand(command: string, message: any): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// For internal use, subject to change.
|
|
3
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
4
|
+
if (mod && mod.__esModule) return mod;
|
|
5
|
+
var result = {};
|
|
6
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
7
|
+
result["default"] = mod;
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
// We use any as a valid input type
|
|
12
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
+
const fs = __importStar(require("fs"));
|
|
14
|
+
const os = __importStar(require("os"));
|
|
15
|
+
const utils_1 = require("./utils");
|
|
16
|
+
function issueCommand(command, message) {
|
|
17
|
+
const filePath = process.env[`GITHUB_${command}`];
|
|
18
|
+
if (!filePath) {
|
|
19
|
+
throw new Error(`Unable to find environment variable for file command ${command}`);
|
|
20
|
+
}
|
|
21
|
+
if (!fs.existsSync(filePath)) {
|
|
22
|
+
throw new Error(`Missing file at path: ${filePath}`);
|
|
23
|
+
}
|
|
24
|
+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
|
25
|
+
encoding: 'utf8'
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.issueCommand = issueCommand;
|
|
29
|
+
//# sourceMappingURL=file-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
package/lib/utils.d.ts
ADDED
package/lib/utils.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// We use any as a valid input type
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
/**
|
|
6
|
+
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
7
|
+
* @param input input to sanitize into a string
|
|
8
|
+
*/
|
|
9
|
+
function toCommandValue(input) {
|
|
10
|
+
if (input === null || input === undefined) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
else if (typeof input === 'string' || input instanceof String) {
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
16
|
+
return JSON.stringify(input);
|
|
17
|
+
}
|
|
18
|
+
exports.toCommandValue = toCommandValue;
|
|
19
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actions/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Actions core lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"github",
|
|
7
7
|
"actions",
|
|
8
8
|
"core"
|
|
9
9
|
],
|
|
10
|
-
"homepage": "https://github.com/actions/toolkit/tree/
|
|
10
|
+
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "lib/core.js",
|
|
13
13
|
"types": "lib/core.d.ts",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"test": "__tests__"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"lib"
|
|
19
|
+
"lib",
|
|
20
|
+
"!.DS_Store"
|
|
20
21
|
],
|
|
21
22
|
"publishConfig": {
|
|
22
23
|
"access": "public"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"directory": "packages/core"
|
|
28
29
|
},
|
|
29
30
|
"scripts": {
|
|
30
|
-
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
|
31
|
+
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
|
31
32
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
32
33
|
"tsc": "tsc"
|
|
33
34
|
},
|