From 4decbc58a680ca2591df5bb7e6058070d038435e Mon Sep 17 00:00:00 2001 From: mEsHaRi Al-AnZi <47438577+Meshari17@users.noreply.github.com> Date: Thu, 12 Mar 2020 09:40:13 +0300 Subject: [PATCH] Revert "Remove legacy checks inside entrypoint.sh (#35)" This reverts commit 4a026f2364f33ac117b5dcb83380b2ba5d8b8e92. --- entrypoint.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 591423e..aa8c7c0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,23 @@ set -e +# Workaround unitl new Actions support neutral strategy +# See how it was before: https://developer.github.com/actions/creating-github-actions/accessing-the-runtime-environment/#exit-codes-and-statuses +NEUTRAL_EXIT_CODE=0 + +# skip if no /rebase +echo "Checking if comment contains '/rebase' command..." +(jq -r ".comment.body" "$GITHUB_EVENT_PATH" | grep -Fq "/rebase") || exit $NEUTRAL_EXIT_CODE + +# skip if not a PR +echo "Checking if issue is a pull request..." +(jq -r ".issue.pull_request.url" "$GITHUB_EVENT_PATH") || exit $NEUTRAL_EXIT_CODE + +if [[ "$(jq -r ".action" "$GITHUB_EVENT_PATH")" != "created" ]]; then + echo "This is not a new comment event!" + exit $NEUTRAL_EXIT_CODE +fi + PR_NUMBER=$(jq -r ".issue.number" "$GITHUB_EVENT_PATH") echo "Collecting information about PR #$PR_NUMBER of $GITHUB_REPOSITORY..."