Skip to content

Global replicator

Global replicator #214

---
# This workflow does not need to be replicated to other repositories. This workflow will update the files in other org
# repos. Currently, this workflow will only run on a workflow dispatch event. Once a solution is made to use the same
# PR branch for updates we can enable updating on push events into `master` branch.
name: Global replicator
on:
push:
branches: [master] # only files that were changed in the commit will be replicated
workflow_dispatch:
inputs:
repo_name:
description: |
You can specify the repository's name where workflows should be pushed manually, as long as workflow settings
do not ignore the repository. If you do not specify the exact repository name, the workflow will try to
replicate all missing changes to all repositories.
required: false
jobs:
replicate:
runs-on: ubuntu-latest
strategy:
fail-fast: false # false to run all, true to fail entire job if any fail
max-parallel: 1 # jobs fail submitting PRs if run too fast
matrix:
include:
- job_name: 'replicate workflows'
patterns_to_ignore: ''
patterns_to_include: >-
.github/dependabot.yml,
.github/label-actions.yml,
.github/pr_release_template.md,
.github/workflows/auto-create-pr.yml,
.github/workflows/automerge.yml,
.github/workflows/autoupdate.yml,
.github/workflows/autoupdate-labeler.yml,
.github/workflows/ci-qodana.yml,
.github/workflows/codeql.yml,
.github/workflows/dispatcher.yml,
.github/workflows/issues.yml,
.github/workflows/issues-stale.yml,
.github/workflows/yaml-lint.yml
patterns_to_remove: >-
.github/workflows/autoupdate.yml,
.github/workflows/autoupdate-labeler.yml,
.github/workflows/pull-requests.yml
commit_message: 'ci: update global workflows'
repos_to_ignore: ''
topics_to_include: ''
exclude_private: false
exclude_forked: true
destination: ''
- job_name: 'replicate python'
patterns_to_ignore: ''
patterns_to_include: >-
.flake8,
.github/workflows/python-flake8.yml
patterns_to_remove: ''
commit_message: 'ci: update global python'
repos_to_ignore: ''
topics_to_include: 'python'
exclude_private: false
exclude_forked: true
destination: ''
- job_name: 'replicate docker'
patterns_to_ignore: ''
patterns_to_include: >-
.github/workflows/ci-docker.yml
patterns_to_remove: ''
commit_message: 'ci: update global docker'
repos_to_ignore: ''
topics_to_include: 'docker'
exclude_private: false
exclude_forked: true
destination: ''
- job_name: 'replicate cpp'
patterns_to_ignore: ''
patterns_to_include: >-
.clang-format,
.github/workflows/cpp-lint.yml
patterns_to_remove: ''
commit_message: 'ci: update global cpp'
repos_to_ignore: ''
topics_to_include: 'cpp'
exclude_private: false
exclude_forked: true
destination: ''
- job_name: 'custom issues'
patterns_to_ignore: ''
patterns_to_include: >-
.github/ISSUE_TEMPLATE/config.yml
patterns_to_remove: ''
commit_message: 'ci: update issue templates'
repos_to_ignore: ''
topics_to_include: 'replicator-custom-issues'
exclude_private: false
exclude_forked: true
destination: ''
- job_name: 'release notifier'
patterns_to_ignore: ''
patterns_to_include: >-
.github/workflows/release-notifier.yml
patterns_to_remove: ''
commit_message: 'ci: update release notifier'
repos_to_ignore: ''
topics_to_include: 'replicator-release-notifications'
exclude_private: false
exclude_forked: true
destination: ''
name: ${{ matrix.job_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Removing files
if: ${{ matrix.patterns_to_remove != '' }}
uses: derberg/manage-files-in-multiple-repositories@v2.1.0
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
committer_username: ${{ secrets.GH_BOT_NAME }}
committer_email: ${{ secrets.GH_BOT_EMAIL }}
patterns_to_ignore: ${{ matrix.patterns_to_ignore }}
patterns_to_remove: ${{ matrix.patterns_to_remove }}
commit_message: ${{ matrix.commit_message }}
repos_to_ignore: ${{ matrix.repos_to_ignore }}
topics_to_include: ${{ matrix.topics_to_include }}
exclude_private: ${{ matrix.exclude_private }}
exclude_forked: ${{ matrix.exclude_forked }}
destination: ${{ matrix.destination }}
bot_branch_name: bot/update-files-from-global-repo
# checkout again to ensure we have a clean GitHub workspace
# see https://github.com/derberg/manage-files-in-multiple-repositories/issues/61#issuecomment-1747013728
- name: Checkout repository
uses: actions/checkout@v4
- name: Replicating files
if: ${{ matrix.patterns_to_include != '' }}
uses: derberg/manage-files-in-multiple-repositories@v2.1.0
with:
github_token: ${{ secrets.GH_BOT_TOKEN }}
committer_username: ${{ secrets.GH_BOT_NAME }}
committer_email: ${{ secrets.GH_BOT_EMAIL }}
patterns_to_ignore: ${{ matrix.patterns_to_ignore }}
patterns_to_include: ${{ matrix.patterns_to_include }}
commit_message: ${{ matrix.commit_message }}
repos_to_ignore: ${{ matrix.repos_to_ignore }}
topics_to_include: ${{ matrix.topics_to_include }}
exclude_private: ${{ matrix.exclude_private }}
exclude_forked: ${{ matrix.exclude_forked }}
destination: ${{ matrix.destination }}
bot_branch_name: bot/update-files-from-global-repo