Skip to content

Instantly share code, notes, and snippets.

@abh006
Created January 14, 2022 08:59

Revisions

  1. abh006 created this gist Jan 14, 2022.
    10 changes: 10 additions & 0 deletions get-branch-name-gh-actions.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    ...
    # Add this as a step to the job in which the branch name is needed
    - name: Set affected branch name
    id: vars
    run: echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/*/}
    ...


    # Use this wherever the branch name is needed
    ${{ steps.vars.outputs.BRANCH_NAME }}