@actions/core
Advanced tools
Comparing version 1.6.0 to 1.10.1
@@ -24,3 +24,3 @@ /** | ||
/** | ||
* Optional properties that can be sent with annotatation commands (notice, error, and warning) | ||
* Optional properties that can be sent with annotation commands (notice, error, and warning) | ||
* See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations. | ||
@@ -50,3 +50,3 @@ */ | ||
/** | ||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. | ||
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. | ||
* Defaults to `startColumn` when `startColumn` is provided. | ||
@@ -189,1 +189,13 @@ */ | ||
export declare function getIDToken(aud?: string): Promise<string>; | ||
/** | ||
* Summary exports | ||
*/ | ||
export { summary } from './summary'; | ||
/** | ||
* @deprecated use core.summary | ||
*/ | ||
export { markdownSummary } from './summary'; | ||
/** | ||
* Path exports | ||
*/ | ||
export { toPosixPath, toWin32Path, toPlatformPath } from './path-utils'; |
@@ -66,9 +66,5 @@ "use strict"; | ||
if (filePath) { | ||
const delimiter = '_GitHubActionsFileCommandDelimeter_'; | ||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; | ||
file_command_1.issueCommand('ENV', commandValue); | ||
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val)); | ||
} | ||
else { | ||
command_1.issueCommand('set-env', { name }, convertedVal); | ||
} | ||
command_1.issueCommand('set-env', { name }, convertedVal); | ||
} | ||
@@ -91,3 +87,3 @@ exports.exportVariable = exportVariable; | ||
if (filePath) { | ||
file_command_1.issueCommand('PATH', inputPath); | ||
file_command_1.issueFileCommand('PATH', inputPath); | ||
} | ||
@@ -132,3 +128,6 @@ else { | ||
.filter(x => x !== ''); | ||
return inputs; | ||
if (options && options.trimWhitespace === false) { | ||
return inputs; | ||
} | ||
return inputs.map(input => input.trim()); | ||
} | ||
@@ -166,4 +165,8 @@ exports.getMultilineInput = getMultilineInput; | ||
function setOutput(name, value) { | ||
const filePath = process.env['GITHUB_OUTPUT'] || ''; | ||
if (filePath) { | ||
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value)); | ||
} | ||
process.stdout.write(os.EOL); | ||
command_1.issueCommand('set-output', { name }, value); | ||
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value)); | ||
} | ||
@@ -297,3 +300,7 @@ exports.setOutput = setOutput; | ||
function saveState(name, value) { | ||
command_1.issueCommand('save-state', { name }, value); | ||
const filePath = process.env['GITHUB_STATE'] || ''; | ||
if (filePath) { | ||
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value)); | ||
} | ||
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value)); | ||
} | ||
@@ -317,2 +324,19 @@ exports.saveState = saveState; | ||
exports.getIDToken = getIDToken; | ||
/** | ||
* Summary exports | ||
*/ | ||
var summary_1 = require("./summary"); | ||
Object.defineProperty(exports, "summary", { enumerable: true, get: function () { return summary_1.summary; } }); | ||
/** | ||
* @deprecated use core.summary | ||
*/ | ||
var summary_2 = require("./summary"); | ||
Object.defineProperty(exports, "markdownSummary", { enumerable: true, get: function () { return summary_2.markdownSummary; } }); | ||
/** | ||
* Path exports | ||
*/ | ||
var path_utils_1 = require("./path-utils"); | ||
Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } }); | ||
Object.defineProperty(exports, "toWin32Path", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } }); | ||
Object.defineProperty(exports, "toPlatformPath", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }); | ||
//# sourceMappingURL=core.js.map |
@@ -1,1 +0,2 @@ | ||
export declare function issueCommand(command: string, message: any): void; | ||
export declare function issueFileCommand(command: string, message: any): void; | ||
export declare function prepareKeyValueMessage(key: string, value: any): string; |
@@ -23,3 +23,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.issueCommand = void 0; | ||
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0; | ||
// We use any as a valid input type | ||
@@ -29,4 +29,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
const os = __importStar(require("os")); | ||
const uuid_1 = require("uuid"); | ||
const utils_1 = require("./utils"); | ||
function issueCommand(command, message) { | ||
function issueFileCommand(command, message) { | ||
const filePath = process.env[`GITHUB_${command}`]; | ||
@@ -43,3 +44,18 @@ if (!filePath) { | ||
} | ||
exports.issueCommand = issueCommand; | ||
exports.issueFileCommand = issueFileCommand; | ||
function prepareKeyValueMessage(key, value) { | ||
const delimiter = `ghadelimiter_${uuid_1.v4()}`; | ||
const convertedValue = utils_1.toCommandValue(value); | ||
// These should realistically never happen, but just in case someone finds a | ||
// way to exploit uuid generation let's not allow keys or values that contain | ||
// the delimiter. | ||
if (key.includes(delimiter)) { | ||
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`); | ||
} | ||
if (convertedValue.includes(delimiter)) { | ||
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`); | ||
} | ||
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`; | ||
} | ||
exports.prepareKeyValueMessage = prepareKeyValueMessage; | ||
//# sourceMappingURL=file-command.js.map |
@@ -14,3 +14,3 @@ "use strict"; | ||
const http_client_1 = require("@actions/http-client"); | ||
const auth_1 = require("@actions/http-client/auth"); | ||
const auth_1 = require("@actions/http-client/lib/auth"); | ||
const core_1 = require("./core"); | ||
@@ -48,3 +48,3 @@ class OidcClient { | ||
Error Code : ${error.statusCode}\n | ||
Error Message: ${error.result.message}`); | ||
Error Message: ${error.message}`); | ||
}); | ||
@@ -51,0 +51,0 @@ const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; |
{ | ||
"name": "@actions/core", | ||
"version": "1.6.0", | ||
"version": "1.10.1", | ||
"description": "Actions core lib", | ||
@@ -33,3 +33,3 @@ "keywords": [ | ||
"test": "echo \"Error: run tests from root\" && exit 1", | ||
"tsc": "tsc" | ||
"tsc": "tsc -p tsconfig.json" | ||
}, | ||
@@ -40,7 +40,9 @@ "bugs": { | ||
"dependencies": { | ||
"@actions/http-client": "^1.0.11" | ||
"@actions/http-client": "^2.0.1", | ||
"uuid": "^8.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.2" | ||
"@types/node": "^12.0.2", | ||
"@types/uuid": "^8.3.4" | ||
} | ||
} | ||
} |
@@ -124,3 +124,3 @@ # `@actions/core` | ||
```js | ||
core.error('This is a bad error. This will also fail the build.') | ||
core.error('This is a bad error, action may still succeed though.') | ||
@@ -167,3 +167,3 @@ core.warning('Something went wrong, but it\'s not bad enough to fail the build.') | ||
/** | ||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. | ||
* The end column for the annotation. Cannot be sent when `startLine` and `endLine` are different values. | ||
* Defaults to `startColumn` when `startColumn` is provided. | ||
@@ -314,2 +314,25 @@ */ | ||
main: 'dist/index.js' | ||
``` | ||
``` | ||
#### Filesystem path helpers | ||
You can use these methods to manipulate file paths across operating systems. | ||
The `toPosixPath` function converts input paths to Posix-style (Linux) paths. | ||
The `toWin32Path` function converts input paths to Windows-style paths. These | ||
functions work independently of the underlying runner operating system. | ||
```js | ||
toPosixPath('\\foo\\bar') // => /foo/bar | ||
toWin32Path('/foo/bar') // => \foo\bar | ||
``` | ||
The `toPlatformPath` function converts input paths to the expected value on the runner's operating system. | ||
```js | ||
// On a Windows runner. | ||
toPlatformPath('/foo/bar') // => \foo\bar | ||
// On a Linux runner. | ||
toPlatformPath('\\foo\\bar') // => /foo/bar | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78092
24
1401
336
1
2
2
16
+ Addeduuid@^8.3.2
+ Added@actions/http-client@2.2.3(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Addedundici@5.28.4(transitive)
+ Addeduuid@8.3.2(transitive)
- Removed@actions/http-client@1.0.11(transitive)
Updated@actions/http-client@^2.0.1