GitHub Action
gha-file-sync
A Simple Github Action for Cross-Repo Files Synchronization using automatic Pull Requests.
For a list of given repositories and file bindings, this action will open/update pull requests to synchronize the files that have changed. The source of files is the repository where the actual github action runs.
For each targeted repository:
- Clone the repository.
- Compute the final branch name and PR according to existing opened PRs.
- Check if changes have been made following files bindings configuration.
- Create or update a pull request if changes have been detected.
- Clean all created files locally.
See action.yml
for more information about configuration
This action only manages to synchronize new files and updated files. Removals or renames are not handled yet. :arrow_right: It is currently advised to blank a file that you want to remove to make it ineffective without having to remove it manually from all repositories.
The action aims to respect Github API Rate (primary & secondary) Limits and to never fail. It uses a rate limiter which bases itself on HTTP headers returned by Github. The action can then take lot of time to be executed though since it waits for the rate-limit-reset time to be reached after each write operation. It can take from some seconds to some hours depending on how many repositories need to be synchronised.
Today, because only a raw copy of the source files is used, the removals and renames of files are not handled yet.
Today, the PR description and comments are pointing by default to the release which triggered the synchronization. It would be better to provide more information about the release, for example:
- the release description.
- the list of added commits.
- the original PR description.
Sometimes the synchronized files are customized locally for some reasons, it is hard to know about it when tens of repositories are involved. The action should raise a warning somewhere if it detects a customization. Some rules as examples:
In order to find customization, it should compare the target files with the version n - 1
of the source files to see if it was already differing.
- if it is a PR creation:
- WARN in the PR desc
- if it is a PR update and the title does not contain
CUSTOM_DETECTED
:- WARN in a comment + update the title with sync
CUSTOM_DETECTED
- WARN in a comment + update the title with sync
- if it is a PR update and the title contains
CUSTOM_DETECTED
:- WARN in a comment
See the LICENSE
file.