Tools

workflow-tools sticks to the Unix-way’s rule Do One Thing and Do It Well. That’s why once installed the package automatically generate executables for each CLI tool.

workflow_secret

Create, update or list GitHub secrets for the repository

EXAMPLES

Let’s work with the repository https://github.com/anna-money/workflow-tools

  1. Create a secret HELLO=WORLD

workflow_secret –owner=anna-money –repo=workflow-tools –token=”account:token” –debug update –key=HELLO –value=WORLD

  1. Get a list of all secrets

workflow_secret –owner=anna-money –repo=workflow-tools –token=”account:token” list

  1. Get info about a secret

workflow_secret –owner=anna-money –repo=workflow-tools –token=”account:token” get –key HELLO

  1. Delete a secret HELLO

workflow_secret –owner=anna-money –repo=workflow-tools –token=”account:token” delete –key HELLO

workflow_secret [OPTIONS] COMMAND [ARGS]...

Options

--owner <owner>

Repository owner

--repo <repo>

Repository name

--token <token>

GitHub access token

--debug, --no-debug

Log debug information

delete

Delete secret

workflow_secret delete [OPTIONS]

Options

--key <key>

GitHub Secret Name

get

Check details of secret

workflow_secret get [OPTIONS]

Options

--key <key>

GitHub Secret Name

list

List all secrets for the repository

workflow_secret list [OPTIONS]

update

Create or update secret in the repository

workflow_secret update [OPTIONS]

Options

--key <key>

GitHub Secret Name

--value <value>

GitHub Secret Value

workflow_generator

GitHub Workflow Generator based on Jinja2 templates.

Interpolate Jinja2 template from INPUT with environment variables and write to OUTPUT.

Template variables to be interpolated in the template should be denoted as follows:

[[ workflow.your_variable ]]

INPUT and OUTPUT can be files or standard input and output respectively. With no INPUT, or when INPUT is -, read standard input. With no OUTPUT, or when OUTPUT is -, write to standard output.

EXAMPLES

  1. Common patterns working with input/output

workflow_generator input.tmpl output.yaml

workflow_generator - output.yaml

workflow_generator input.tmpl -

workflow_generator input.tmpl

tail -n 12 input.tmpl | workflow_generator > output.yaml

  1. Generate Pull Request GitHub workflow with the values taken from the envfile

workflow_generator YOUR-TEMPLATES-PATH/pr.tmpl YOUR-WORKFLOWS-PATH/pr.yml -e YOUR-TEMPLATES-PATH/.env.example

  1. Override values from envfile by the environment variable

WORKFLOW_PROJECT=test workflow_generator YOUR-TEMPLATES-PATH/pr.tmpl -e YOUR-TEMPLATES-PATH/.env.example

workflow_generator [OPTIONS] [INPUT] [OUTPUT]

Options

-p, --prefix <prefix>

Set prefix for envs to be used in template interpolation

-e, --envfile <envfile>

Load env from file. OS envs overwrite file values

--secrets, --no-secrets

Show only secrets needed for the workflow

--vars, --no-vars

Show only user defined variables needed for the workflow

--strict, --no-strict

Throw exceptions for undefined variables

Arguments

INPUT

Optional argument

OUTPUT

Optional argument