Sign inSign up

ddhhz/github-sync

By ddhhz

Updated about 7 years ago

A GitHub Action for syncing between two independent repositories using hard reset.

Image
0

1.1K

ddhhz/github-sync repository overview

Github Sync

A GitHub Action for syncing between two independent repositories using hard reset.

Usage

Github Actions
workflow "Sync workflow" {
  resolves = ["repo-sync"]
  on = "schedule(*/5 * * * *)"
}

action "repo-sync" {
  uses = "docker://ddhhz/github-sync:0.0.1-alpha"
  args = "$SOURCE_REPO $SOURCE_BRANCH:$DESTINATION_BRANCH"
  secrets = ["GITHUB_TOKEN"]
}

GITHUB_TOKEN Must be checked under secrets.

If SOURCE_REPO is private or with another provider, either (1) set a SSH_PRIVATE_KEY secret and use the SSH clone url or (2) use an authenticated HTTPS repo clone url like https://username:[email protected]/username/repository.git.

Known Issue

The job may fail if upstream has a .workflow file present. Consider using git-sync instead.

Advanced Usage: Sync all branches

  1. Make a backup
  2. Create a new branch in your repo (destination repo), it should not share the name with any branch in source repo
  3. Make the new branch the default branch under repo settings
  4. Use *:* in place of $SOURCE_BRANCH:$DESTINATION_BRANCH

This will force sync ALL branches to match source repo. Branches that are created only in the destination repo will not be affected but all the other branches will be hard reset to match source repo. ⚠️ This does mean if upstream ever creates a branch that shares the name, your changes will be gone.

License

MIT

Tag summary

Content type

Image

Digest

Size

12.1 MB

Last updated

about 7 years ago

docker pull ddhhz/github-sync