From 24eb8b3354e0ecfa667fddd9816e05fa2a877e2b Mon Sep 17 00:00:00 2001 From: Joe Doss Date: Fri, 11 Dec 2020 16:03:53 -0600 Subject: [PATCH] Rework the PULL_REQUEST_ID logic, again (#11871) and move github.event.issue.number to the workflow file.... --- .github/workflows/buildkite.yml | 1 + scripts/create_buildkite_pr_build.sh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/buildkite.yml b/.github/workflows/buildkite.yml index fd14f842d..3cd4df2db 100644 --- a/.github/workflows/buildkite.yml +++ b/.github/workflows/buildkite.yml @@ -25,3 +25,4 @@ jobs: BUILDKITE_API_ACCESS_TOKEN: ${{ secrets.buildkite_api_access_token }} PIPELINE: "forem/build-containers" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PULL_REQUEST_ID: ${{ github.event.issue.number }} diff --git a/scripts/create_buildkite_pr_build.sh b/scripts/create_buildkite_pr_build.sh index 810a54b54..1cf99f1b2 100755 --- a/scripts/create_buildkite_pr_build.sh +++ b/scripts/create_buildkite_pr_build.sh @@ -27,11 +27,11 @@ if [[ -z "$GITHUB_TOKEN" ]]; then exit 1 fi -# Get the pull request ID -PULL_REQUEST_ID=${{ github.event.issue.number }} - +# Check if PULL_REQUEST_ID is empty or null and try to set it if [[ -z "${PULL_REQUEST_ID}" || "${PULL_REQUEST_ID}" == "null" ]]; then - PULL_REQUEST_ID=${{ github.event.number }} + PULL_REQUEST_ID=$(jq -r .event.issue.number "${GITHUB_EVENT_PATH}") +elif [[ -z "${PULL_REQUEST_ID}" || "${PULL_REQUEST_ID}" == "null" ]]; then + PULL_REQUEST_ID=$(jq -r .event.number "${GITHUB_EVENT_PATH}") elif [[ -z "${PULL_REQUEST_ID}" || "${PULL_REQUEST_ID}" == "null" ]]; then echo "Failed to determine PR Number." exit 1