Skip to content

Mirror your new main branch to your old master branch (or mirror any branch A to any branch B)

Notifications You must be signed in to change notification settings

zofrex/mirror-branch

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

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mirror Branch action

Want to rename a branch? Want to rename it right now, but worried that it will break things that are pulling from its current name (e.g. CI jobs)?

Have you already renamed a branch and broken everything and you want to fix it ASAP?

This action updates another branch whenever you push to the branch it's triggered on. It should serve as a handy stopgap while you track down those last few jobs that are still set to the old name.

Inputs

target-branch

The name of the branch to update. Default "master".

force

Whether or not to force push. "true" means to force push, "false" means don't. Defaults to true.

Example usage

Mirror the release-candidate branch to the master branch:

name: Mirror branch

on:
  push:
    branches: [ release-candidate ]

jobs:
  mirror-to-master:
    runs-on: ubuntu-latest
    steps:
    - uses: zofrex/mirror-branch@v1

Mirror the release branch to the deployment branch, but don't force push:

name: Mirror branch

on:
  push:
    branches: [ release ]

jobs:
  mirror-to-master:
    runs-on: ubuntu-latest
    steps:
    - uses: zofrex/mirror-branch@v1
      with:
        target-branch: deployment

Note that the source branch to copy from is not an option for this action, so you should limit it to only run on one branch, unless you're absolutely certain that you want to mirror multiple branches to one target.

About

Mirror your new main branch to your old master branch (or mirror any branch A to any branch B)

Topics

Resources

Stars

Watchers

Forks