From c698603a7db849d6cb69c1658f74d2e80181cafc Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Sat, 12 Nov 2022 16:07:18 -0700 Subject: [PATCH] fix: bug with branch name with PR's from forks --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 9e87aa0..c96b798 100644 --- a/action.yml +++ b/action.yml @@ -73,7 +73,7 @@ runs: run: | # "Set the current branch name..." if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then - if [[ ${{ github.event_name }} == 'pull_request' ]]; then + if [[ ${{ github.event_name }} == 'pull_request' || ${{ github.event_name }} == 'pull_request_target' ]]; then if [[ -z "$GITHUB_OUTPUT" ]]; then echo "::set-output name=current_branch::${{ steps.branch.outputs.head_ref_branch }}" else @@ -92,7 +92,7 @@ runs: run: | # "Set the default branch name..." if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then - if [[ "${{ steps.current_branch.outputs.current_branch }}" == "${{ github.event.repository.default_branch }}" ]]; then + if [[ "${{ steps.current_branch.outputs.current_branch }}" == "${{ github.event.repository.default_branch }}" && "${{ github.event.head.fork }}" != "true" ]]; then if [[ -z "$GITHUB_OUTPUT" ]]; then echo "::set-output name=is_default::true" echo "::set-output name=default_branch::${{ github.event.repository.default_branch }}"