From dbfd5e10a7e2b970effb15af7988a83e19a9b840 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sun, 1 Jan 2023 11:39:47 -0700 Subject: [PATCH] fix: bug running on pull_request_review (#915) --- .github/workflows/test.yml | 6 +++--- action.yml | 6 +++--- diff-sha.sh | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34dad0f5..f69ea7d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,9 +12,9 @@ on: - reopened branches: - main -# pull_request_review -# branches: -# - main + pull_request_review: + branches: + - main jobs: shellcheck: diff --git a/action.yml b/action.yml index 4f3d923c..8d3d84ed 100644 --- a/action.yml +++ b/action.yml @@ -182,8 +182,8 @@ runs: GITHUB_REPOSITORY: ${{ github.repository }} GITHUB_REF: ${{ github.ref }} GITHUB_SHA: ${{ github.sha }} - GITHUB_BASE_REF: ${{ github.base_ref }} - GITHUB_HEAD_REF: ${{ github.head_ref }} + GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }} + GITHUB_HEAD_REF: ${{ github.event.pull_request.head.ref }} GITHUB_WORKSPACE: ${{ github.workspace }} GITHUB_EVENT_NUMBER: ${{ github.event.number }} GITHUB_EVENT_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }} @@ -226,7 +226,7 @@ runs: shell: bash env: GITHUB_WORKSPACE: ${{ github.workspace }} - GITHUB_BASE_REF: ${{ github.base_ref }} + GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }} GITHUB_EVENT_HEAD_REPO_FORK: ${{ github.event.pull_request.head.repo.fork }} # INPUT_ is not available in Composite run steps # https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs diff --git a/diff-sha.sh b/diff-sha.sh index ef02928e..f6d337d4 100644 --- a/diff-sha.sh +++ b/diff-sha.sh @@ -50,6 +50,8 @@ else echo "Valid git version found: ($GIT_VERSION)" fi +echo "Base Ref: $GITHUB_BASE_REF" + if [[ -z $GITHUB_BASE_REF ]]; then echo "Running on a push event..." TARGET_BRANCH=$GITHUB_REFNAME