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
This commit is contained in:
Cat™ 2021-01-15 05:21:44 +00:00 committed by GitHub
parent 126cce3cfe
commit 460ed2db04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -79,24 +79,29 @@ act -v
# Flags # Flags
``` ```
-a, --actor string user that triggered the event (default "nektos/act")
-b, --bind bind working directory to container, rather than copy -b, --bind bind working directory to container, rather than copy
--defaultbranch string the name of the main branch
-C, --directory string working directory (default ".") -C, --directory string working directory (default ".")
-n, --dryrun dryrun mode -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 -e, --eventpath string path to event JSON file
-g, --graph draw workflows
-h, --help help for act -h, --help help for act
--insecure-secrets NOT RECOMMENDED! Doesn't hide secrets while printing logs.
-j, --job string run job -j, --job string run job
-l, --list list workflows -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) -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 -p, --pull pull docker image(s) if already present
-q, --quiet disable logging of output from steps -q, --quiet disable logging of output from steps
-r, --reuse reuse action containers to maintain state -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) -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 -v, --verbose verbose output
--version version for act --version version for act
-w, --watch watch the contents of the local repo and run when files change -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 # 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=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 -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. - `act --secret-file my.secrets` - load secrets values from `my.secrets` file.
- secrets file format is the same as `.env` format
# Configuration # Configuration
@ -169,9 +175,16 @@ Additionally, act supports loading environment variables from an `.env` file. Th
act --env-file my.env act --env-file my.env
``` ```
`.env`:
```
MY_ENV_VAR=MY_ENV_VAR_VALUE
MY_2ND_ENV_VAR="my 2nd env var value"
```
# Skipping steps # 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. don't want to run locally. E.g. a step that posts a Slack message or bumps a version number.
```yml ```yml

View File

@ -296,7 +296,7 @@ func (rc *RunContext) EvalBool(expr string) (bool, error) {
interpolatedPart, isString := rc.ExprEval.InterpolateWithStringCheck(part) interpolatedPart, isString := rc.ExprEval.InterpolateWithStringCheck(part)
// This peculiar transformation has to be done because the Github parser // 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 // Hence env.SOMETHING will be evaluated to true in an if: expression
// regardless if SOMETHING is set to false, true or any other string. // 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. // It also handles some other weirdness that I found by trial and error.