Skip to content

JosiahSiegel/remote-branch-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

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Remote Branch Action

Test Action

Synopsis

  1. Create a branch on a remote repository.
  2. actions/checkout determins the active repo.

Usage

Single repo

jobs:
  create-branch-action:
    name: Create branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Create branch
        uses: JosiahSiegel/[email protected]
        with:
          branch: new-branch

Single alternative repo

jobs:
  create-branch-action:
    name: Create branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Checkout alt repo
        uses: actions/checkout@v4
        with:
          sparse-checkout: .
          repository: me/alt-repo
          token: ${{ secrets.ALT_REPO_TOKEN }}
          path: alt-repo

      - name: Create branch on alt repo
        uses: JosiahSiegel/[email protected]
        with:
          branch: new-branch-alt-repo
          path: alt-repo

Multiple repos

jobs:
  create-branch-action:
    name: Create branch
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Checkout second repo
        uses: actions/checkout@v4
        with:
          sparse-checkout: .
          repository: me/second-repo
          token: ${{ secrets.SECONDARY_REPO_TOKEN }}
          path: second-repo

      - name: Create branch
        id: create-branch-action
        uses: JosiahSiegel/[email protected]
        with:
          branch: new-branch

      - name: Create branch on second repo
        id: create-branch-action-second-repo
        uses: JosiahSiegel/[email protected]
        with:
          branch: new-branch-second-repo
          path: second-repo

      - name: Get create branch status
        run: echo ${{ steps.create-branch-action.outputs.create-status }}
  
      - name: Get create branch status on second repo
        run: echo ${{ steps.create-branch-action-second-repo.outputs.create-status }}

Inputs

inputs:
  branch:
    description: Branch name
    required: true
  path:
    description: Relative path under $GITHUB_WORKSPACE to place the repository
    required: false
    default: '.'

Outputs

outputs:
  create-status:
    description: Branch creation status
    value: ${{ steps.create-branch.outputs.create_status }}