From 6e109f46c99f41d72cd76a9c3ef695ccab79b930 Mon Sep 17 00:00:00 2001 From: mcpengelly Date: Mon, 17 Jun 2019 10:24:51 -0400 Subject: [PATCH] [prevent-cancelling-other-workflows] allow an optional environment variable for specifying a desired exitcode --- entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b5f8df2..f2e8fe1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -23,6 +23,12 @@ action=$(jq --raw-output .action "$GITHUB_EVENT_PATH") number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") assignee=$(jq --raw-output .assignee.login "$GITHUB_EVENT_PATH") +# Github Actions will mark a check as "neutral" (neither failed/succeeded) when you exit with code 78 +# But this will terminate any other Actions running in parallel in the same workflow. +# Configuring this Environment Variable `REVIEWERS_UNMODIFIED_EXIT_CODE=0` if no branch was deleted will let your workflow continue. +# Docs: https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#exit-codes-and-statuses +REVIEWERS_UNMODIFIED_EXIT_CODE=${REVIEWERS_UNMODIFIED_EXIT_CODE:-78} + update_review_request() { curl -sSL \ -H "Content-Type: application/json" \ @@ -39,5 +45,5 @@ elif [[ "$action" == "unassigned" ]]; then update_review_request 'DELETE' else echo "Ignoring action ${action}" - exit 78 -fi \ No newline at end of file + exit "$REVIEWERS_UNMODIFIED_EXIT_CODE" +fi