Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set a REVIEWERS_UNMODIFIED_EXIT_CODE, avoiding parallel action cancellation #4

Merged
merged 2 commits into from
Jun 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -17,6 +17,12 @@ action "Assignee to reviewer" {
secrets = [
"GITHUB_TOKEN"
]

# add this line if you want to continue running parrallel github actions even if this action is skipped/not needed
env = {
REVIEWERS_UNMODIFIED_EXIT_CODE = "0"
}
}
}
```

10 changes: 8 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
exit "$REVIEWERS_UNMODIFIED_EXIT_CODE"
fi