Copycat is a tool for synchronizing files between repositories.
It can:
- create a web server,
- listen to requests,
- parse GitHub webhooks,
- create pull requests to the target repository with the changes from the source repository
You can use Copycat to:
- synchronize documentation between project repository and documentation repository
- share code between multiple projects
- connect a monorepo to a project's own repository
These instructions will get you Copycat up and running on your local machine
To run Copycat, you will need node.js > 7.10.
Copy config.json.tpl
as config.json
and update config:
- token – Github account's token you want to use for synchronization
- userAgent – it will be used in requests to Github API
- syncAccountName – the name of the account used for synchronization
- syncFiles – an array of objects with the sync config
A sample config.json:
{
"token": "xxx",
"userAgent": "Copycat-Docs-Synchronizer",
"syncAccountName": "livechat-docs-synchronizer",
"pullRequestBranchPrefix": "update-libs-",
"syncFiles": [
{
"from": {
"owner": "livechat",
"repo": "copycat",
"path": "lib/"
},
"to": {
"owner": "livechat",
"repo": "copycat-lib-only",
"path": "lib/"
},
"refsMap": {
"labs": "labs",
"master": "master"
}
}
]
}
To start Copycat, run npm run start
To test Copycat, you'll need to expose your local server (created by Copycat with the npm run start command) to public and add a webhook to your GitHub repository.
To expose the local server, you can use ngrok. A detailed description is available in the Configuring Your Server section in the GitHub documentation.
./ngrok http 3081
Next, set up github to send webook requests to your local machine.
- Copy the address created by ngrok:
- Paste it to your GitHub webhook settings:
The easiest way to deploy Copycat is to use a "node as a service" provider (AWS Elastic Beanstalk, Heroku or Zeit).
After the deployment, add a webhook to your GitHub repository
- Go to your repository’s Settings > Webhooks > Add webhook
- Paste there the URL of your deployed service, e.g. https://copycat.example.org/webhook/push
Fix destination directory
First public Release
Konrad Kruk / LiveChat
Mateusz Burzyński / LiveChat
This project is licensed under the MIT License