Skip to content

Gets the current git branch name of the running action for both pull_request and push triggers.

Notifications You must be signed in to change notification settings

EthanSK/git-branch-name-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-branch-name-action

Gets the current git branch name of the running action for both pull_request and push triggers.

UPDATE: Doesn't work if your branch name has '/' in the name...sorry.

Usage

on: [push, pull_request]

jobs:
  main_job:
    runs-on: ubuntu-latest
    steps:
      - name: Git branch name
        id: git-branch-name
        uses: EthanSK/git-branch-name-action@v1
      - name: Echo the branch name
        run: echo "Branch name ${GIT_BRANCH_NAME}"

If you want to check the branch name in an if statement, you can do something like:

if: ${{ env.GIT_BRANCH_NAME == 'master' }}

About

Gets the current git branch name of the running action for both pull_request and push triggers.

Resources

Stars

Watchers

Forks

Packages

No packages published