{"id":13550513,"url":"https://github.com/repo-sync/repo-sync","last_synced_at":"2025-04-03T00:34:06.906Z","repository":{"id":44478069,"uuid":"199347862","full_name":"repo-sync/repo-sync","owner":"repo-sync","description":"🔄 Keep a pair of GitHub repos in sync","archived":true,"fork":false,"pushed_at":"2023-04-03T17:15:00.000Z","size":375,"stargazers_count":171,"open_issues_count":4,"forks_count":26,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-03T20:35:50.676Z","etag":null,"topics":["github","github-actions"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/repo-sync.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-28T23:38:02.000Z","updated_at":"2024-09-22T18:10:47.000Z","dependencies_parsed_at":"2024-05-28T17:14:19.771Z","dependency_job_id":"87b413fa-593c-4e4f-a8ea-451ee1c33797","html_url":"https://github.com/repo-sync/repo-sync","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repo-sync%2Frepo-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repo-sync%2Frepo-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repo-sync%2Frepo-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/repo-sync%2Frepo-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/repo-sync","download_url":"https://codeload.github.com/repo-sync/repo-sync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916734,"owners_count":20854511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","github-actions"],"created_at":"2024-08-01T12:01:34.193Z","updated_at":"2025-04-03T00:34:04.932Z","avatar_url":"https://github.com/repo-sync.png","language":null,"readme":"# Repo Sync\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)\n\n\u003e Keep a pair of GitHub repos in sync.\n\n## How it Works\n\nThis project uses [GitHub Actions](https://github.com/features/actions) workflows to keep pairs of git repos in sync. It runs on a [schedule](#cron) (every 15 minutes by default). Shortly after changes are made to the default branch of **repo A**, the Actions workflow runs on **repo B** and generates a pull request including the recent changes from **repo A**. If more changes are made to **repo A** before the pull request is merged, those changes will be added to the existing pull request. The same is true in the opposite direction: changes made to **repo B** will eventually get picked up by the workflow in **repo A**. \n\n## Features\n\n- One-way or two-way sync\n- Sync between a private and public repo\n- Sync between two private repos\n- Sync between two public repos\n- Sync from a third-party repo to a Github repo\n- Uses Github Actions and a flexible scheduled job. No external service required!\n\n## Requirements\n\n- Your two repos must share a commit history. (If they do not already, you might need to [Combine Git repositories](https://gist.github.com/msrose/2feacb303035d11d2d05) before you begin.)\n- Your repos must be using GitHub Actions v2. Sign up at [github.com/features/actions](https://github.com/features/actions)\n\n## Installation\n\n### Step 1. Set up Secrets\n\n[GitHub Secrets] are variables stored on your GitHub repository that are made available in the GitHub Actions environment. There are two (2) required secrets on each repo. Go to **Settings \u003e Security \u003e Secrets and variables \u003e Actions \u003e New repository secret** on your repo page and add the following secrets:\n\n#### `SOURCE_REPO`\n\nThe shorthand name or URL of the repo to sync.\n\n- If the source repo is a **public** GitHub repo, use a shorthand name like `owner/repo`.\n- If the source repo is a **private** GitHub repo, specify an HTTPS clone URL in the format `https://\u003caccess_token\u003e@github.com/owner/repo.git` that includes an access token with `repo` and `workflow` scopes. You can [generate a token](https://github.com/settings/tokens/new?description=repo-sync\u0026scopes=repo,workflow) in your Github settings.\n- If the source repo is not hosted on GitHub, specify an HTTPS URL that includes pull access credentials.\n\n\n#### `INTERMEDIATE_BRANCH`\n\nThe name of the temporary branch to use when creating a pull request, for example, `repo-sync`. You can use whatever name you like, but do NOT use the name of a branch that already exists, as it will be overwritten.\n\n### Step 2. Create Actions workflow files\n\nCreate a file `.github/workflows/repo-sync.yml` in **both repositories** and add the following content:\n\n```yaml\nname: Repo Sync\n\non:\n  schedule: \n  - cron: \"*/15 * * * *\" # every 15 minutes. set to whatever interval you like\n\njobs:\n  repo-sync:\n    name: Repo Sync\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v3\n    - uses: repo-sync/github-sync@v2\n      name: Sync repo to branch\n      with:\n        source_repo: ${{ secrets.SOURCE_REPO }}\n        source_branch: main\n        destination_branch: ${{ secrets.INTERMEDIATE_BRANCH }}\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n    - uses: repo-sync/pull-request@v2\n      name: Create pull request\n      with:\n        source_branch: ${{ secrets.INTERMEDIATE_BRANCH }}\n        destination_branch: main\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n```\n\nTo set up two-way sync, create these files in both repositories. To set up one-way sync, you only need to do this step in the target (destination) repository.\n\n### Step 3. Watch the pull requests roll in!\n\nThere is no step 3! Once you commit to the repo, the workflows run on the schedule you specified in the workflow file. When repo-sync finds changes, it creates a pull request. If an unmerged repo-sync pull request already exists on the destination repo, repo-sync updates the existing PR.\n\n## Advanced configuration\n\nThe workflow file is fully customizable allowing for advanced configurations.\n\n#### cron\n\nThe default cron is every 15 minutes. This can be easily adjusted by changing the cron string.\n\n#### Manual events\n\nInstead of triggering workflows using the cron scheduler, you can set up [manual events](https://help.github.com/en/articles/events-that-trigger-workflows#manual-events) to trigger the workflow when the source repo changes.\n\n#### Workflow steps\n\nYou can add or remove workflow steps to meet your needs. For example, you might remove the \"Create pull request\" to commit directly, or you could add a \"Merge pull request\" step.\n\n#### One-Way Syncs\n\nFor one-way syncs, set up the workflow in the target repository only as described above.\n\n#### Customize pull request\n\nYou can customize the PR/s title, body, label, reviewer, assingee, and milestone by setting environment variables as explained at [repo-sync/pull-request](https://github.com/repo-sync/pull-request#advanced-options).\n\n#### Use SSH clone URL and deploy keys\n\nYou can use a SSH clone URL and specify an `SSH_PRIVATE_KEY` environment variable instead of using the https clone URL.\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://whe.me\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/5880908?v=4\" width=\"100px;\" alt=\"Wei He\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eWei He\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#design-wei\" title=\"Design\"\u003e🎨\u003c/a\u003e \u003ca href=\"https://github.com/repo-sync/repo-sync/commits?author=wei\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/repo-sync/repo-sync/commits?author=wei\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://zeke.sikelianos.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/2289?v=4\" width=\"100px;\" alt=\"Zeke Sikelianos\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eZeke Sikelianos\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/repo-sync/repo-sync/commits?author=zeke\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-zeke\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n\n\n[GitHub Secrets]: https://help.github.com/en/actions/configuring-and-managing-workflows/using-variables-and-secrets-in-a-workflow\n[Actions workflow file]: https://help.github.com/en/articles/configuring-a-workflow\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepo-sync%2Frepo-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frepo-sync%2Frepo-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frepo-sync%2Frepo-sync/lists"}