FATMAP / gha-file-sync

Github Action for Cross-Repos File Synchronisation using Pull Requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gha-file-sync

A Simple Github Action for Cross-Repo Files Synchronization using automatic Pull Requests.

GoDoc

What

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:

  1. Clone the repository.
  2. Compute the final branch name and PR according to existing opened PRs.
  3. Check if changes have been made following files bindings configuration.
  4. Create or update a pull request if changes have been detected.
  5. Clean all created files locally.

Configuration

See action.yml for more information about configuration

Known issues

File deletion/rename are not handled.

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.

Pull Request Creations/Updates can take hours.

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.

Potential Improvements

Handling of removed/renamed files

Today, because only a raw copy of the source files is used, the removals and renames of files are not handled yet.

Commits messages as PR desc

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.

'Customs' Detection

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
  • if it is a PR update and the title contains CUSTOM_DETECTED:
    • WARN in a comment

Additional Information

License

See the LICENSE file.

Assets

GIF made by @egonelbre is licensed by CC0 1.0

About

Github Action for Cross-Repos File Synchronisation using Pull Requests

License:MIT License


Languages

Language:Go 97.0%Language:Dockerfile 2.2%Language:Makefile 0.8%