From 367ec0c61c43de19fbb1ae7a01283eb66b436d9a Mon Sep 17 00:00:00 2001 From: Max Held Date: Mon, 20 May 2019 19:49:10 +0200 Subject: [PATCH] explain how to "skip" some actions using filter I just figured this out; might be helpful for other users. --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 842f4463..f26e3f5b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,21 @@ act -r act -v ``` +# Skip Actions When Run in `act` + +You may sometimes want to skip some actions when you're running a `main.workflow` in act, such as deployment. +You can achieve something similar by using a [filter](https://github.com/actions/bin/tree/master/filter) action, filtering on all [`GITHUB_ACTOR`](https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#environment-variables)s *except* `nektos/act`, which is the `GITHUB_ACTOR` set by `act`. + +``` +action "Filter Not Act" { + uses = "actions/bin/filter@3c0b4f0e63ea54ea5df2914b4fabf383368cd0da" + args = "not actor nektos/act" +} +``` + +Just remember that GitHub actions will cancel all upcoming and concurrent actions on a neutral exit code. +To avoid prematurely cancelling actions, place this filter at the latest possible point in the build graph. + # Support Need help? Ask on [Gitter](https://gitter.im/nektos/act)!