Get Default Branch Name

mindaugaslaganeckas

MindaugasLaganeckas

Posted on September 1, 2020

Get Default Branch Name

Get the default branch or an empty string, if there are no branches in the repository.

You can call the action in your workflow like this:

    - name: Get default branch name
      id: defaultBranchName
      uses: MindaugasLaganeckas/get-default-branch@v1
      with:
        token: ${{ secrets.SUPER_SECRET }}
        path: ${{ env.OWNER }}/${{ env.REPO }}
Enter fullscreen mode Exit fullscreen mode

You can access the output like this:

    - name: Change to master branch if repository is empty
      if: ${{ steps.defaultBranchName.outputs.default-branch == '' }}
Enter fullscreen mode Exit fullscreen mode

Submission Category:

Maintainer Must-Haves

Yaml File or Link to Code

https://github.com/MindaugasLaganeckas/get-default-branch

💖 💪 🙅 🚩
mindaugaslaganeckas
MindaugasLaganeckas

Posted on September 1, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Animal Search App
githubhack23 Animal Search App

May 20, 2023

Uses Sentinel
github Uses Sentinel

March 5, 2023