JosiahSiegel / remote-branch-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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/remote-branch-action@v1.1.0
        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/remote-branch-action@v1.1.0
        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/remote-branch-action@v1.1.0
        with:
          branch: new-branch

      - name: Create branch on second repo
        id: create-branch-action-second-repo
        uses: JosiahSiegel/remote-branch-action@v1.1.0
        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 }}

About

License:MIT License