From a9ebb75435509bbb48e5892d3ff53b8c10a6b800 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 May 2021 12:23:47 -0400 Subject: [PATCH 1/2] Set the current_branch for release actions Resolves: #50 --- action.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 128b024..b191499 100644 --- a/action.yml +++ b/action.yml @@ -33,9 +33,9 @@ runs: - id: branch run: | if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then - export BASE_REF=${{ github.base_ref }} - export HEAD_REF=${{ github.head_ref }} - export REF=${{ github.ref }} + BASE_REF=${{ github.base_ref }} + HEAD_REF=${{ github.head_ref }} + REF=${{ github.ref }} echo "::set-output name=base_ref_branch::${BASE_REF/refs\/heads\//}" echo "::set-output name=head_ref_branch::${HEAD_REF/refs\/heads\//}" REF_BRANCH=${REF/refs\/pull\//} @@ -63,7 +63,9 @@ runs: - id: tag run: | if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then - export REF=${{ github.ref }} + REF=${{ github.ref }} + REF_BRANCH=${REF/refs\/tags\//} + echo "::set-output name=current_branch::$REF_BRANCH" TAG=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/} echo "::set-output name=tag::$TAG" fi From 653ab74a8a3a069dd2069063a9857c577e1aca0d Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 25 May 2021 12:26:52 -0400 Subject: [PATCH 2/2] Update action.yml --- action.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index b191499..0fb5842 100644 --- a/action.yml +++ b/action.yml @@ -44,10 +44,16 @@ runs: shell: bash - id: current_branch run: | - if [[ ${{ github.event_name }} == 'pull_request' && "${{ github.ref }}" != "refs/tags/"* ]]; then - echo "::set-output name=current_branch::${{ steps.branch.outputs.head_ref_branch }}" + if [[ "${{ github.ref }}" != "refs/tags/"* ]]; then + if [[ ${{ github.event_name }} == 'pull_request' ]]; then + echo "::set-output name=current_branch::${{ steps.branch.outputs.head_ref_branch }}" + else + echo "::set-output name=current_branch::${{ steps.branch.outputs.ref_branch }}" + fi else - echo "::set-output name=current_branch::${{ steps.branch.outputs.ref_branch }}" + REF=${{ github.ref }} + REF_BRANCH=${REF/refs\/tags\//} + echo "::set-output name=current_branch::$REF_BRANCH" fi shell: bash - id: default @@ -64,8 +70,6 @@ runs: run: | if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then REF=${{ github.ref }} - REF_BRANCH=${REF/refs\/tags\//} - echo "::set-output name=current_branch::$REF_BRANCH" TAG=${REF/refs\/tags\/${{ inputs.strip_tag_prefix }}/} echo "::set-output name=tag::$TAG" fi