Skip to content

A GitHub App built with Probot that automatically syncs upstream changes to forks.

License

Notifications You must be signed in to change notification settings

primetheus/auto-fork-sync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Probot: GitHub Fork Sync

npm version

GitHub Permissions

This plugin requires these Permissions & events for the GitHub App:

Permissions

This app only makes use of the following permissions

Permission Additional Info Access Level
Pull requests Read & Write
Repository contents Read & Write
Single File Path:.github/auto-fork-sync.yml Read-only

Events

These events are all recommended so that the synchronization process happens more regularly, but whether they are required or not is noted in the table below.

Event Description Required
Push Git push to a repository Yes
Create Branch or tag created Yes

Installing the app

  1. Log in to GitHub
  2. Navigate to the Org settings
  3. Click the GitHub Apps link on the left github-org-settings
  4. Provide the details for the app github-app-details
  5. Select the permissions github-app-permissions
  6. Select the events to subscribe to github-app-events
  7. If this app will be used by other users and orgs, be sure to allow this to run on Any account github-app-make-public
  8. Generate a private key github-app-generate-key-1 github-app-generate-key-2
  9. Download and save the key github-app-download-key
  10. Click on Install App
  11. Select the auto-fork-sync app
  12. Choose an organization to install it to
  13. Select the repositories, or choose All repositories and click Install github-app-install-to-org
  14. All done! Fork some repos! github-app-install-complete

Running the app

Running in native NodeJS

# Install dependencies
npm install
# Start the bot
npm start

Running in Docker

  1. Clone the repository
$ git clone https://github.com/primetheus/auto-fork-sync.git
$ cd auto-fork-sync
  1. Build the image
docker build -t github/auto-fork-sync .
  1. Run the container
docker run -ditp 3000:3000 --restart unless-stopped --name auto-fork-sync github/auto-fork-sync

Running with Forever

You can use the Forever node package as well. (This assumes you've installed the app to /opt/auto-fork-sync)

forever start --minUptime 1000 \
    --spinSleepTime 1000 \
    --workingDir /opt/auto-fork-sync \
    -a -w -l /opt/auto-fork-sync/.forever/forever.log \
    -o /opt/auto-fork-sync/.forever/out.log \
    -e /opt/auto-fork-sync/.forever/err.log \
    -c "npm start" ./

Running with Systemd

You can also run this service as a daemon. This sample assumes that the app is installed in /opt/auto-fork-sync.

Create a service file in /etc/systemd/system/auto-fork-sync.service and add the following contents

[Unit]
Description=GitHub Probot - Auto Fork Sync
After=network-online.target

[Service]
PIDFile=/opt/auto-fork-sync/auto-fork-sync.pid
User=node
Group=node
Restart=on-failure
# do chdir before running the service
WorkingDirectory=/opt/auto-fork-sync/
ExecStart=/usr/bin/npm start
KillSignal=SIGQUIT
# limit CPU and RAM quota for our service
CPUAccounting=true
CPUQuota=10%
MemoryAccounting=true
MemoryLimit=250M

[Install]
WantedBy=multi-user.target

Once you've created the file you will be able to enable, disable, start, stop, restart and check the status of the application.

systemctl status auto-fork-sync.service
systemctl enable auto-fork-sync.service
systemctl start auto-fork-sync.service

About

A GitHub App built with Probot that automatically syncs upstream changes to forks.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 84.3%
  • Dockerfile 15.7%