A GitHub Action for synchronizing a git branch to another location via SSH.
Name | Description | Default | Required |
---|---|---|---|
source-branch |
Branch name in the source repository | Yes | |
destination-repo |
SSH URL of the destination repository | Yes | |
source-repo |
SSH URL of the source repository | The respository this action runs in | No |
destination-branch |
Branch name in the destination repository | Same as source-branch |
No |
SSH_PRIVATE_KEY
: Create a SSH key without a passphrase which has access to both repositories.
On GitHub you should add the public key to repository "deploy keys".
Store the private key as a secret and use it in your workflow as seen in the example usage below.
name: Sync main branch to Bitbucket
on: [push, delete, create]
jobs:
git-mirror:
runs-on: ubuntu-latest
steps:
- uses: zent-contrib/sync-git-branch@v1
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source-branch: main
destination-repo: "git@bitbucket.org:<org>/<repo>.git"