Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gleich/gh_fsync
🔄 GitHub action to sync files across repos in GitHub
https://github.com/gleich/gh_fsync
file gh-fsync github-actions sync-files
Last synced: about 1 month ago
JSON representation
🔄 GitHub action to sync files across repos in GitHub
- Host: GitHub
- URL: https://github.com/gleich/gh_fsync
- Owner: gleich
- License: mit
- Created: 2020-08-12T16:01:30.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T16:58:20.000Z (almost 2 years ago)
- Last Synced: 2024-10-28T09:53:36.703Z (about 2 months ago)
- Topics: file, gh-fsync, github-actions, sync-files
- Language: Go
- Homepage:
- Size: 155 KB
- Stars: 19
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-hackclub - gh_fsync - [@gleich](https://github.com/gleich) - **(Go)** _🔄 GitHub action to sync files across repos in GitHub_ (GitHub Actions)
- jimsghstars - gleich/gh_fsync - 🔄 GitHub action to sync files across repos in GitHub (Go)
README
# gh_fsync ![Docker Pulls](https://img.shields.io/docker/pulls/mattgleich/gh_fsync)
🔄 GitHub action to sync files across repos in GitHub
![build](https://github.com/gleich/gh_fsync/workflows/build/badge.svg)
![test](https://github.com/gleich/gh_fsync/workflows/test/badge.svg)
![lint](https://github.com/gleich/gh_fsync/workflows/lint/badge.svg)
![release](https://github.com/gleich/gh_fsync/workflows/release/badge.svg)## ❓ What is gh_fsync
gh_fsync is a simple, configurable, and blazing fast way to sync files in your repository with files from another repository.
## ⚙️ Configuration
First create a file in one of the following locations inside of your repository:
- `/fsync.yml`
- `/fsync.yaml`
- `/.fsync.yml`
- `/.fsync.yaml`
- `/.github/fsync.yml`
- `/.github/fsync.yml`Now that you have your file lets go over the syntax.
### 🌍 Global replace
Replace certain text for all source files listed under the files section. Below is an example:
```yaml
replace:
- before: project_name
after: gh_fsync
```### 📁 Files
List all of the files you want to sync. `path:` is the file path in your repo and `source:` is the URL on GitHub for the file. Below is an example:
```yaml
files:
- path: CONTRIBUTING.md
source: https://github.com/gleich/go_template/blob/master/CONTRIBUTING.md
```You can even replace values specific to a file. Below is an example:
```yaml
files:
- path: CONTRIBUTING.md
source: https://github.com/gleich/go_template/blob/master/CONTRIBUTING.md
replace:
- before: project_name
after: gh_fsync2
```A file specific replace will override any global replace with the same `before`. So in the case shown below the replace of `project_name` for the `CONTRIBUTING.md` file will override the global replace defined before. If you would like to completely ignore the global replace for that file add `ignore_global_replace: true` to the file. This is optional and an example is shown down in the examples section.
```yaml
replace:
- before: project_name
after: gh_fsync
files:
- path: CONTRIBUTING.md
source: https://github.com/gleich/go_template/blob/master/CONTRIBUTING.md
replace:
- before: project_name
after: gh_fsync2
```### 💬 Commit message
Define the commit message to use when updating the files. The default commit message is `Update via sync`. Below is an example
```yaml
commit_message: 🔄 Update file via sync
```### ✨ Example
```yaml
commit_message: 🔄 Update file via sync
replace:
- before: project_name
after: gh_fsync
files:
- path: CONTRIBUTING.md
source: https://github.com/gleich/go_template/blob/master/CONTRIBUTING.md
replace:
- before: project_name
after: gh_fsync2
- path: LICENSE.md
source: https://github.com/gleich/go_template/blob/master/LICENSE.md
ignore_global_replace: true
replace:
- before: author_name
after: Matthew Gleich
```### 🤖 GitHub action
Use the following for the GitHub action.
```yaml
name: gh_fsyncon:
push:
branches:
- master
schedule:
- cron: '*/30 * * * *' # Runs every 30 minutesjobs:
file_sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: gh_fsync
uses: gleich/gh_fsync@master
```If you want to sync files from the `.github` folder you need to to create a personal access token with the `read` and `workflows` permissions. Then set a secret for the repo with the value being the personal access token and the name being `PERSONAL_ACCESS_TOKEN`. Finally change your action file to the following:
```yaml
name: fsyncon:
push:
branches:
- master
schedule:
- cron: '*/30 * * * *' # Runs every 30 minutesjobs:
file_sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: gh_fsync
uses: gleich/gh_fsync@master
```## 🙌 Contributing
Before contributing please read the [CONTRIBUTING.md file](https://github.com/gleich/gh_fsync/blob/master/CONTRIBUTING.md)
## 👥 Contributors
- **[@gleich](https://github.com/gleich)**