github_actions_toolkit

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

github actions toolkit

github_actions_toolkit #
A third-party toolkit for GitHub Actions coded in Dart. It is inspired by the official Javascript actions/toolkit and contains similar commands.
Check out this gist for different templates to create a GitHub Action in Dart.
Usage #
Logging #
Logging commands are available under log.
There are four levels:

error
warning
info
debug

Logs with info level will have no particular emphasis and be directly transmitted to stdout.
Logs with debug level will only appear if the secret ACTIONS_STEP_DEBUG has been created in the repository with the value true (see "Creating and using encrypted secrets").
import 'package:github_actions_toolkit/github_actions_toolkit.dart' as gaction;

main() async {
const logger = gaction.log;

logger
..info('This is just a message')
..warning('This is a warning message')
..error('This is an error message');

// [isDebug] is true iff the secret `ACTIONS_STEP_DEBUG` has been configured
final message = gaction.isDebug
? 'This is a debug message'
: 'This is a debug message that you will not see';
logger.debug(message);
}
copied to clipboard
Inputs #
Create an Input object for each input that your action needs, and retrieve their value with the value getter.
This getter will throw an ArgumentError if the input had been set as required and is missing.
import 'package:github_actions_toolkit/github_actions_toolkit.dart' as gaction;

main() async {
const input = gaction.Input(
'who-to-greet', // name defined in the YAML file
isRequired: true,
);

gaction
.log
.info('Hello ${input.value}!');
}
copied to clipboard
Outputs #
Set an output for subsequent steps with setOutput.
Subprocesses #
Execute a command in the shell with the exec function. It will return an ExecResult object once the command has terminated with its exit code and its outputs.
import 'package:github_actions_toolkit/github_actions_toolkit.dart' as gaction;

main() async {
final process = await gaction.exec('echo', ['Hello world']);

gaction
.log
.info("The 'echo' command has terminated with code ${process.exitCode} and has printed ${process.stdout}");
}
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.