From 460ed2db04db009552e3dd5a3d5fe64a666b1675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cat=E2=84=A2?= Date: Fri, 15 Jan 2021 05:21:44 +0000 Subject: [PATCH] Update parts of repo (#476) * Update flags in README * Add secrets and `.env` files examples * Fix typo: environment * Fix typo: returned * Add --version back, since I've built act without ldflags --- README.md | 21 +++++++++++++++++---- pkg/runner/run_context.go | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3367c1a..0d72e7b 100644 --- a/README.md +++ b/README.md @@ -79,24 +79,29 @@ act -v # Flags ``` + -a, --actor string user that triggered the event (default "nektos/act") -b, --bind bind working directory to container, rather than copy + --defaultbranch string the name of the main branch -C, --directory string working directory (default ".") -n, --dryrun dryrun mode - --env-file string environment file to read (default ".env") + --env-file string environment file to read and use as env in the containers (default ".env") -e, --eventpath string path to event JSON file + -g, --graph draw workflows -h, --help help for act + --insecure-secrets NOT RECOMMENDED! Doesn't hide secrets while printing logs. -j, --job string run job -l, --list list workflows -P, --platform stringArray custom image to use per platform (e.g. -P ubuntu-18.04=nektos/act-environments-ubuntu:18.04) + --privileged use privileged mode -p, --pull pull docker image(s) if already present -q, --quiet disable logging of output from steps -r, --reuse reuse action containers to maintain state -s, --secret stringArray secret to make available to actions with optional value (e.g. -s mysecret=foo or -s mysecret) - --secret-file file with list of secrets to read from (e.g. --secret-file .secrets) + --secret-file string file with list of secrets to read from (e.g. --secret-file .secrets) -v, --verbose verbose output --version version for act -w, --watch watch the contents of the local repo and run when files change - -W, --workflows string path to workflow files (default "./.github/workflows/") + -W, --workflows string path to workflow file(s) (default "./.github/workflows/") ``` # Known Issues @@ -153,6 +158,7 @@ To run `act` with secrets, you can enter them interactively, supply them as envi - `act -s MY_SECRET=somevalue` - use `somevalue` as the value for `MY_SECRET`. - `act -s MY_SECRET` - check for an environment variable named `MY_SECRET` and use it if it exists. If the environment variable is not defined, prompt the user for a value. - `act --secret-file my.secrets` - load secrets values from `my.secrets` file. + - secrets file format is the same as `.env` format # Configuration @@ -169,9 +175,16 @@ Additionally, act supports loading environment variables from an `.env` file. Th act --env-file my.env ``` +`.env`: + +``` +MY_ENV_VAR=MY_ENV_VAR_VALUE +MY_2ND_ENV_VAR="my 2nd env var value" +``` + # Skipping steps -Act adds a special environement variable `ACT` that can be used to skip a step that you +Act adds a special environment variable `ACT` that can be used to skip a step that you don't want to run locally. E.g. a step that posts a Slack message or bumps a version number. ```yml diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 6c99e6f..a7de642 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -296,7 +296,7 @@ func (rc *RunContext) EvalBool(expr string) (bool, error) { interpolatedPart, isString := rc.ExprEval.InterpolateWithStringCheck(part) // This peculiar transformation has to be done because the Github parser - // treats false retured from contexts as a string, not a boolean. + // treats false returned from contexts as a string, not a boolean. // Hence env.SOMETHING will be evaluated to true in an if: expression // regardless if SOMETHING is set to false, true or any other string. // It also handles some other weirdness that I found by trial and error.