file-sync
A GitHub Action which synchronizes files from another repository



Features
- Keep files across multiple repositories up to date automatically
- Opens a pull request for file sync updates
- Easily configurable
- Optionally deletes files
Example Usage
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: champ-oss/file-sync
with:
token: ${{ secrets.GITHUB_TOKEN }}
repo: champ-oss/terraform-module-template
files: |
.gitignore
Makefile
templates/LICENSE-template=LICENSE
myworkflow.yml=.github/workflows/build.yml
delete-files: |
.github/workflows/old-workflow.yml
Token
By default the GITHUB_TOKEN should be passed to the actions/checkout step as well as this action (see example usage). This is necessary for the action to be allowed to push changes to a branch as well as open a pull request.
Important:
If you are syncing workflow files (.github/workflows) then you will need to generate and use a Personal Access Token (PAT) with repo and workflow permissions.
File list
One file should be specified per-line. You can specify the file in the format <source_path>=<destination_path. The paths are relative to the root of the source and destination repositories.
For example:
files: |
templates/mystuff/.gitignore.tmpl=.gitignore
myworkflow.yml=.github/workflows/build.yml
Or, if only a filename is specified then file will be copied from the source to the destination in the same directory path and name.
For example:
files: |
.gitignore
Parameters
| Parameter |
Required |
Description |
| token |
false |
GitHub Token or PAT |
| repo |
true |
Source GitHub repo |
| files |
true |
List of files to sync |
| target-branch |
false |
Target branch for pull request |
| pull-request-branch |
false |
Branch to push changes |
| user |
false |
Git username |
| email |
false |
Git email |
| commit-message |
false |
Updated by file-sync |
| delete-files |
false |
List of files to delete |
Contributing