Rework the PULL_REQUEST_ID logic, again (#11871)

and move github.event.issue.number to the workflow file....
This commit is contained in:
Joe Doss 2020-12-11 16:03:53 -06:00 committed by GitHub
parent f88608ccf6
commit 24eb8b3354
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -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 }}

View file

@ -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