Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@actions/core

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actions/core - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

lib/command.d.ts

@@ -12,6 +12,6 @@ interface CommandProperties {

* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
* ##[set-secret name=mypassword]definitelyNotAPassword!
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message: string): void;
export declare function issue(name: string, message?: string): void;
export {};

@@ -12,3 +12,3 @@ "use strict";

* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
* ##[set-secret name=mypassword]definitelyNotAPassword!
*/

@@ -20,3 +20,3 @@ function issueCommand(command, properties, message) {

exports.issueCommand = issueCommand;
function issue(name, message) {
function issue(name, message = '') {
issueCommand(name, {}, message);

@@ -23,0 +23,0 @@ }

@@ -74,1 +74,22 @@ /**

export declare function warning(message: string): void;
/**
* Begin an output group.
*
* Output until the next `groupEnd` will be foldable in this group
*
* @param name The name of the output group
*/
export declare function startGroup(name: string): void;
/**
* End an output group.
*/
export declare function endGroup(): void;
/**
* Wrap an asynchronous function call in a group.
*
* Returns the same type as the function itself.
*
* @param name The name of the group
* @param fn The function to wrap in the group
*/
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -39,3 +48,6 @@ const command_1 = require("./command");

exportVariable(name, val);
// the runner will error with not implemented
// leaving the function but raising the error earlier
command_1.issueCommand('set-secret', {}, val);
throw new Error('Not implemented.');
}

@@ -117,2 +129,42 @@ exports.exportSecret = exportSecret;

exports.warning = warning;
/**
* Begin an output group.
*
* Output until the next `groupEnd` will be foldable in this group
*
* @param name The name of the output group
*/
function startGroup(name) {
command_1.issue('group', name);
}
exports.startGroup = startGroup;
/**
* End an output group.
*/
function endGroup() {
command_1.issue('endgroup');
}
exports.endGroup = endGroup;
/**
* Wrap an asynchronous function call in a group.
*
* Returns the same type as the function itself.
*
* @param name The name of the group
* @param fn The function to wrap in the group
*/
function group(name, fn) {
return __awaiter(this, void 0, void 0, function* () {
startGroup(name);
let result;
try {
result = yield fn();
}
finally {
endGroup();
}
return result;
});
}
exports.group = group;
//# sourceMappingURL=core.js.map

@@ -0,0 +0,0 @@ Copyright 2019 GitHub

{
"name": "@actions/core",
"version": "1.0.0",
"version": "1.1.0",
"description": "Actions core lib",
"keywords": [
"core",
"actions"
"github",
"actions",
"core"
],

@@ -36,3 +37,3 @@ "homepage": "https://github.com/actions/toolkit/tree/master/packages/core",

},
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55"
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
}

@@ -11,3 +11,3 @@ # `@actions/core`

```
```js
const core = require('@actions/core');

@@ -22,7 +22,7 @@

#### Exporting variables/secrets
#### Exporting variables
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:
You can also export variables for future steps. Variables get set in the environment.
```
```js
const core = require('@actions/core');

@@ -33,3 +33,2 @@

core.exportVariable('envVar', 'Val');
core.exportSecret('secretVar', variableWithSecretValue);
```

@@ -41,3 +40,3 @@

```
```js
const core = require('@actions/core');

@@ -52,3 +51,3 @@

```
```js
const core = require('@actions/core');

@@ -68,5 +67,5 @@

Finally, this library provides some utilities for logging:
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
```
```js
const core = require('@actions/core');

@@ -79,3 +78,3 @@

if (!myInput) {
core.warning('myInput wasnt set');
core.warning('myInput was not set');
}

@@ -86,4 +85,21 @@

catch (err) {
core.error('Error ${err}, action may still succeed though');
core.error(`Error ${err}, action may still succeed though`);
}
```
This library can also wrap chunks of output in foldable groups.
```js
const core = require('@actions/core')
// Manually wrap output
core.startGroup('Do some function')
doSomeFunction()
core.endGroup()
// Wrap an asynchronous function call
const result = await core.group('Do something async', async () => {
const response = await doSomeHTTPRequest()
return response
})
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc