github-api icon indicating copy to clipboard operation
github-api copied to clipboard

Is it possible to programmatically sync a fork?

Open tiagomlalves opened this issue 2 years ago • 3 comments

I'm looking into a programatically way to sync a fork using GitHub Java API. Is this supported?

  • Instructions for CLI: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork
  • Instructions for REST: https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#sync-a-fork-branch-with-the-upstream-repository

I'm using GitHub Java API to automate a PR that we need to do as part of release process. Some of the PRs are done in public/open-source repositories where one needs to create a fork (or sync that fork if it already exists), makes changes in the fork, and then open a PR to the original project.

I've implemented this automation using the REST API but I would be interested in doing it with GitHub Java API if possible to use a single style for all my repo automations.

tiagomlalves avatar Mar 14 '23 00:03 tiagomlalves

PR to add this functionality is welcome. Creating tests may be a bit involved. You might need to set up the repo and fork manually and then run/record the automated test.

bitwiseman avatar Mar 20 '23 18:03 bitwiseman

Same issue here

jonesbusy avatar Jul 15 '24 09:07 jonesbusy