Giter Site home page Giter Site logo

prmirror's Introduction

PRMirror

Mirror's pull requests from one repository to another

Getting started

  • This is best off done on a fresh repository as it's likely that you have lots of modified upstream code. We did this for our latest branch https://github.com/HippieStation/HippieStation - We try to maintain modular code by using an additional folder for all of our code: https://github.com/HippieStation/HippieStation/tree/master/hippiestation
  • Compile the code by running go get and then go build
  • Copy the following file into your repository merge-upstream-pull-request.sh
  • Make sure that merge-upstream-pull-request.sh is marked as executable (chmod +x merge-upstream-pull-request.sh)
  • Clone the repo to disk
  • Make sure that you can push new commits back to the repository from the cloned directory, IE: Setup SSH keys or Github Username/Password
  • Run the program to generate a blank config
    • GitHubToken should be a GitHub Access Token
    • Upstream is at tgstation/tgstation and Downstream is at HippieStation/HippieStation
      • UpstreamOwner for us is tgstation
      • UpstreamRepo for us is tgstation
      • DownstreamOwner for us is HippieStation
      • DownstreamRepo for us is HippieStation
    • RepoPath is the path to the repository on disk, for us this is: /home/prmirror/HippieStation/
    • ToolPath is the path to the tool from within the repository, for us this is: hippiestation/tools/merge-upstream-pull-request.sh
    • UseWebhook - should be set to true if you're using the GitHub webhook system instead of scraping the events API
    • WebhookPort - if you're using the webhook system, set the port for the HTTP server to listen on
    • WebhookSecret - if you're using the webhook system, generate a secure secret and set it both on GitHub and in here so we can verify the payloads
  • Make sure before you run the PRMirrorer for the first time that you are 1-1 with your upstream.
  • Run the PRMirrorer standalone first to make sure it works, it will open some PRs (just close these, this is a bug which someone could fix), if it polls and is working, continue to set it up as a service and make sure that it doesn't go down
  • You're done.

Current issues:

  • On the first run it will open some PRs even though you already have them
  • It seems to miss some PRs sometimes, we're working on this - not sure why yet.
  • If your server running the bot does down and you don't notice for awhile - you will have issues, it uses the GitHub events API and if the mirrorer is down for too long that the PR merge events are no longer in the event stream you will have an issue - you'll need to do a manual rebase to fix this.

prmirror's People

Contributors

chnkr avatar cyberboss avatar j-mie avatar jamieh avatar jjrcop avatar ninjanomnom avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

prmirror's Issues

Make it easier to apply changes to files with merge conflicts or DME changes

https://github.com/{DOWNSTREAM REPO OWNER}/{DOWNSTREAM REPO NAME}/edit/{BRANCH NAME}/{DME NAME}.dme?pr={PR URL} URL to the body, or comments of the PR whenever there are DME changes.

https://github.com/{DOWNSTREAM REPO OWNER}/{DOWNSTREAM REPO NAME}/edit/{BRANCH NAME}/{FILE}.{EXT}?pr={PR URL} to the body, or comments of the PR for all files that contain merge errors

Some PRs aren't being mirrored properly

Compare upstream PR: https://github.com/tgstation/tgstation/pull/25003/commits and then downstream PR: https://github.com/HippieStation/HippieStation/pull/34/commits

We need to get the merge commit hash from the upstream repo and then cherry-pick that and send a PR, Not sure if this should be a command for the bot or just done automatically, since this issue is likely to get worse and worse the longer we run this system and it'd suck if someone made a mistake and merged like 100 random commits.

Likely going to need to work on git repos here - this seems good: https://github.com/src-d/go-git - there are many libraries though so your choice.

Features that would be nice to have

  1. Automatic .dme updating, it fetches the diffs from the upstream .dme and applies them to the downstream's.
  2. Automatic tgui recompiling, although this could theorically be done not just for mirrors but for any PR that edits ract files, since compiling this shit requires a miracle
  3. Some sort of warning if tg edits a file which we have hooks too, basically it could scan our .dme, if there's a file with the same path+filename in the downstream's modular folder, it says "hey careful, we could have redefines/hook procs that need to be updated".
  4. Automatically update opened mirrors if another mirror is merged. Some mirrors are dependant on previous ones and when this happens, it must either be remade or updated manually.
    will add more if i get more ideas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.