/forkrefresh

Refresh your github forks to be up to date with the source

Primary LanguageJavaScriptMIT LicenseMIT

Forkrefresh

Bring Git forks up to date with the original source repositories without downloading/cloning anything to your local environment.

Uses only the Github/Bitbucket API calls to sync.

Demo

Try it live

Running as a docker container

  docker run -it --rm -v forkrefresh:/root/.config/configstore -p 8080:8080 alexivkin/forkrefresh

The first time it runs docker will download the latest pre-built image. You can then access the webapp via http://localhost:8080

Running natively

  1. Install NodeJS 14+
  2. Clone this repository
  3. Run npm install
  4. Register the app with the OAuth provider (see the "configuring authentication" section below)
  5. Now run it as node server.js

Configuring authentication

It uses the full flow OAuth2. You will need to register your app on the server and then configure the app before you can login.

  • GitHub - go to new OAuth app, name the app, point the callback to http://yourhost:port/gh/callback. No need to specify permissions scopes as they are handled at the access time. Copy key and secret and then set GH_OAUTH2_ID and GH_OAUTH2_SECRET environment variables and run the app so it can store them. With docker you can do it using the docker -e option.
  • Bitbucket - go to new OAuth consumer. Give read permissions to the account and the repositories. Point the callback to http://yourhost:port/bb/callback. Copy key and secret and then set BB_OAUTH2_ID and BB_OAUTH2_SECRET environment variables and run the app so it can store them

Authentication details are saved in the configstore, so you only need to do it once. To reset authentication simply remove .config/configstore.

Notes

  • This is a full stack app (server and client js). It could be done as a client-only single page app, but handling the GitHub OAuth SPA flow and API pagination would be tricky.
  • Tested against GitHub API v3
  • This code is full of hacks to bring the origial GH API v14 implementation to v18. It's neither pretty nor the best designed.
  • Bitbucket and the CLI parts have been falling by the wayside and no longer working.

References