Skip to content

Instantly share code, notes, and snippets.

@abh006
Created January 14, 2022 08:59
Show Gist options
  • Save abh006/bade9bfac58f2a01125a1c4ba1997ad5 to your computer and use it in GitHub Desktop.
Save abh006/bade9bfac58f2a01125a1c4ba1997ad5 to your computer and use it in GitHub Desktop.
Get current branch name inside a Github Action
...
# 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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment