diff options
author | ChristopherHX <christopher.homberger@web.de> | 2022-12-06 16:09:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 16:09:13 +0100 |
commit | 7073eac24057020cd54bcb00402281be55df3246 (patch) | |
tree | 06d73c45bdfd5f2a233fc2a233a40192561c0f1d /README.md | |
parent | Pass `LANG=C.UTF-8` to environment (#1476) (diff) | |
download | forgejo-act-7073eac24057020cd54bcb00402281be55df3246.tar.xz forgejo-act-7073eac24057020cd54bcb00402281be55df3246.zip |
docs: clarifying skipping steps / jobs (#1480)
* docs: clarifying skipping steps / jobs
* fix lint
* Update README.md
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -342,10 +342,41 @@ MY_ENV_VAR=MY_ENV_VAR_VALUE MY_2ND_ENV_VAR="my 2nd env var value" ``` +# Skipping jobs + +You cannot use the `env` context in job level if conditions, but you can add a custom event property to the `github` context. You can use this method also on step level if conditions. + +```yml +on: push +jobs: + deploy: + if: ${{ !github.event.act }} # skip during local actions testing + runs-on: ubuntu-latest + steps: + - run: exit 0 +``` + +And use this `event.json` file with act otherwise the Job will run: + +```json +{ + "act": true +} +``` + +Run act like + +```sh +act -e event.json +``` + +_Hint: you can add / append `-e event.json` as a line into `./.actrc`_ + # Skipping steps 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. +**You cannot use this method in job level if conditions, see [Skipping jobs](#skipping-jobs)** ```yml - name: Some step |