diff --git a/action.yml b/action.yml index e86c37d..309b82e 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: required: false outputs: + current_branch: + value: ${{ steps.current_branch.outputs.current_branch }} + description: 'Returns the value of the current branch which is consistent regardless of event_type: i.e (push, pull_requests).' base_ref_branch: value: ${{ steps.branch.outputs.base_ref_branch }} description: 'The target branch of a pull request' @@ -43,6 +46,13 @@ runs: REF_BRANCH=${REF/refs\/pull\//} echo "::set-output name=ref_branch::${REF_BRANCH/refs\/heads\//}" shell: bash + - id: current_branch + run: | + 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 branding: icon: git-branch color: white