Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
git-branch

GitHub Action

Get branch name

v1

Get branch name

git-branch

Get branch name

Export branch name as environment variable

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Get branch name

uses: nelonoel/branch-name@v1

Learn more about this action in nelonoel/branch-name

Choose a version

Use branch name on GitHub actions

Convenience action for using current branch name.

Usage

name: build
on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - run: npm ci
    - uses: nelonoel/branch-name@v1
    # Use branch name for whatever purpose
    - run: echo ${BRANCH_NAME}