Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simoncropp/githubsync
A tool to help synchronizing specific files and folders across GitHub hosted repositories
https://github.com/simoncropp/githubsync
Last synced: 8 days ago
JSON representation
A tool to help synchronizing specific files and folders across GitHub hosted repositories
- Host: GitHub
- URL: https://github.com/simoncropp/githubsync
- Owner: SimonCropp
- License: mit
- Created: 2013-12-06T20:57:14.000Z (almost 11 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T09:51:14.000Z (19 days ago)
- Last Synced: 2024-10-29T17:27:02.861Z (17 days ago)
- Language: C#
- Homepage:
- Size: 1.28 MB
- Stars: 23
- Watchers: 6
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
# GitHubSync
[![Build status](https://ci.appveyor.com/api/projects/status/sjkccpx6avnw8vbv/branch/main?svg=true)](https://ci.appveyor.com/project/SimonCropp/GitHubSync)
[![NuGet Status](https://img.shields.io/nuget/v/GitHubSync.svg?label=GitHubSync)](https://www.nuget.org/packages/GitHubSync/)
[![NuGet Status](https://img.shields.io/nuget/v/GitHubSync.Tool.svg?label=dotnet%20tool)](https://www.nuget.org/packages/GitHubSync.Tool/)A tool to help synchronizing specific files and folders across repositories
**See [Milestones](../../milestones?state=closed) for release notes.**
## .net API
### NuGet package
https://nuget.org/packages/GitHubSync/
### Usage
```cs
// Create a new RepoSync
var repoSync = new RepoSync(
log: Console.WriteLine);// Add source repo(s)
repoSync.AddSourceRepository(new(
// Valid credentials for the source repo and all target repos
credentials: octokitCredentials,
owner: "UserOrOrg",
repository: "TheSingleSourceRepository",
branch: "master"));// Add sources(s), only allowed when SyncMode == ExcludeAllByDefault
repoSync.AddBlob("sourceFile.txt");
repoSync.AddBlob("code.cs");// Remove sources(s), only allowed when SyncMode == IncludeAllByDefault
repoSync.AddBlob("sourceFile.txt");
repoSync.AddBlob("code.cs");// Add target repo(s)
repoSync.AddTargetRepository(new(
credentials: octokitCredentials,
owner: "UserOrOrg",
repository: "TargetRepo1",
branch: "master"));repoSync.AddTargetRepository(new(
credentials: octokitCredentials,
owner: "UserOrOrg",
repository: "TargetRepo2",
branch: "master"));// Run the sync
await repoSync.Sync(syncOutput: SyncOutput.MergePullRequest);
```
snippet source | anchor## dotnet Tool
This tool allows reading the configuration from a file. This allows customization of the templates and repositories without
having to recompile any code.### Installation
Ensure [dotnet CLI is installed](https://docs.microsoft.com/en-us/dotnet/core/tools/).
Install [GitHubSync.Tool](https://nuget.org/packages/GitHubSync.Tool/)
```ps
dotnet tool install -g GitHubSync.Tool
```### Usage
Run against the current directory will use `githubsync.yaml` in the current directory:
```ps
githubsync
```Run against a specific config file:
```ps
githubsync C:\Code\Project\sync.yaml
```### Configuration definition
The configuration format is yaml. There should be 1 to n number of templates and 1 to n number of (target) repositories.
```yaml
templates:
- name: [template name]
url: [repository url of the template]
branch: [branch to use, defaults to `master`]
repositories:
- name: [repository name]
url: [repository url of the target repository]
branch: [target branch, defaults to `master`]
autoMerge: [true / false, true is only used when user is allowed to merge PRs on the target repository]
templates:
- [list of template names to use in the order to apply]
```### Example
```yaml
templates:
- name: geertvanhorrik
url: https://github.com/geertvanhorrik/repositorytemplate
branch: master
- name: catel
url: https://github.com/Catel/RepositoryTemplate.Components
branch: master
- name: wildgums-components-public
url: https://github.com/wildgums/RepositoryTemplate.Components.Public
branch: master
repositories:
- name: CsvHelper
url: https://github.com/JoshClose/CsvHelper
branch: master
autoMerge: false
templates:
- geertvanhorrik
- name: Catel
url: https://github.com/catel/catel
branch: develop
autoMerge: true
templates:
- geertvanhorrik
- catel
- name: Orc.Controls
url: https://github.com/wildgums/orc.controls
branch: develop
autoMerge: true
templates:
- geertvanhorrik
- wildgums-components-public
```This example will result in the following:
* CsvHelper => use geertvanhorrik
* Catel => use geertvanhorrik + catel (combined, so catel can override files)
* Orc.Controls => use geertvanhorrik + wildgums-components-public (combined, so wildgums-components-public can override files)## Icon
[Sync](https://thenounproject.com/term/sync/290/) designed by [Edward Boatman](https://thenounproject.com/edward) from [The Noun Project](https://thenounproject.com).