Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
folder-plus

GitHub Action

gh_fsync

v1.0.0

gh_fsync

folder-plus

gh_fsync

πŸ”„ GitHub action to sync files across repos in GitHub

Installation

Copy and paste the following snippet into your .yml file.

              

- name: gh_fsync

uses: gleich/gh_fsync@v1.0.0

Learn more about this action in gleich/gh_fsync

Choose a version

gh_fsync

πŸ”„ GitHub action to sync files across repos in GitHub

build test lint release

❓ 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:

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:

files:
  - path: CONTRIBUTING.md
    source: https://github.com/Matt-Gleich/go_template/blob/master/CONTRIBUTING.md

You can even replace values specific to a file. Below is an example:

files:
  - path: CONTRIBUTING.md
    source: https://github.com/Matt-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:

replace:
  - before: project_name
    after: gh_fsync
files:
  - path: CONTRIBUTING.md
    source: https://github.com/Matt-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

commit_message: πŸ”„ Update file via sync

✨ Example

commit_message: πŸ”„ Update file via sync
replace:
  - before: project_name
    after: gh_fsync
files:
  - path: CONTRIBUTING.md
    source: https://github.com/Matt-Gleich/go_template/blob/master/CONTRIBUTING.md
    replace:
      - before: project_name
        after: gh_fsync2
  - path: LICENSE.md
    source: https://github.com/Matt-Gleich/go_template/blob/master/LICENSE.md
    replace:
      - before: author_name
        after: Matthew Gleich

πŸ€– GitHub action

Use the following for the GitHub action:

path: gh_fsync

on:
  push:
  schedule:
    - cron: '*/10 * * * *' # Runs every 10 minutes

jobs:
  file_sync:
    runs-on: ubuntu-latest
    steps:
      - path: Checkout Repository
        uses: actions/checkout@v2
      - path: gh_fsync
        uses: Matt-Gleich/gh_fsync@master

πŸ™Œ Contributing

Before contributing please read the CONTRIBUTING.md file

πŸ‘₯ Contributors