From 54b37dca13e18fbe5f22f408ac37a49548b8b81b Mon Sep 17 00:00:00 2001 From: Luke Bjerring Date: Fri, 19 Jun 2020 07:30:58 -0400 Subject: [PATCH] Add support for pull_request webhook events (#55) * Use pull_request not issue * Fall back to issue number, exit if still null * Fix variable use --- entrypoint.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 96d268d..8090654 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,7 +2,14 @@ set -e -PR_NUMBER=$(jq -r ".issue.number" "$GITHUB_EVENT_PATH") +PR_NUMBER=$(jq -r ".pull_request.number" "$GITHUB_EVENT_PATH") +if [[ "$PR_NUMBER" == "null" ]]; then + PR_NUMBER=$(jq -r ".issue.number" "$GITHUB_EVENT_PATH") +fi +if [[ "$PR_NUMBER" == "null" ]]; then + echo "Failed to determine PR Number." + exit 1 +fi echo "Collecting information about PR #$PR_NUMBER of $GITHUB_REPOSITORY..." if [[ -z "$GITHUB_TOKEN" ]]; then