From 2751ab4d92fbb4802bb2229b6d20a7ca48a475f3 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Wed, 21 Aug 2024 16:55:33 +0200 Subject: [PATCH] ci: trigger MAINTAINERS.yaml update for each CODEOWNERS file change (#307) --- .github/workflows/global-replicator.yml | 22 ++++++++++++++- .../workflows/update-maintainers-trigger.yaml | 28 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/update-maintainers-trigger.yaml diff --git a/.github/workflows/global-replicator.yml b/.github/workflows/global-replicator.yml index feed9dc1..b4ee56f2 100644 --- a/.github/workflows/global-replicator.yml +++ b/.github/workflows/global-replicator.yml @@ -215,4 +215,24 @@ jobs: committer_username: asyncapi-bot committer_email: info@asyncapi.io commit_message: "ci: update .prettierignore from global .github repo" - bot_branch_name: bot/update-files-from-global-repo \ No newline at end of file + bot_branch_name: bot/update-files-from-global-repo + + # This setup is separate from the generic workflow setup because this workflow is mandatory. + # Maintainers cannot opt out for any reason except technical ones. + replicate_update_maintainers_workflow: + if: startsWith(github.repository, 'asyncapi/') + name: Replicate update-maintainers-trigger.yml workflow in the required repositories + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Replicating file + uses: derberg/manage-files-in-multiple-repositories@beecbe897cf5ed7f3de5a791a3f2d70102fe7c25 + with: + github_token: ${{ secrets.GH_TOKEN }} + patterns_to_include: .github/workflows/update-maintainers-trigger.yml + repos_to_ignore: community,shape-up-process # community repo is ignored as it has its own version of this workflow, version that is triggered by this workflow + committer_username: asyncapi-bot + committer_email: info@asyncapi.io + commit_message: "ci: update update-maintainers-trigger.yml workflow from global .github repo" + bot_branch_name: bot/update-files-from-global-repo diff --git a/.github/workflows/update-maintainers-trigger.yaml b/.github/workflows/update-maintainers-trigger.yaml new file mode 100644 index 00000000..12fc4abe --- /dev/null +++ b/.github/workflows/update-maintainers-trigger.yaml @@ -0,0 +1,28 @@ +# This action is centrally managed in https://github.com/asyncapi/.github/ +# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo + +name: Trigger MAINTAINERS.yaml file update + +on: + push: + branches: [ master ] + paths: + # Check all valid CODEOWNERS locations: + # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location + - 'CODEOWNERS' + - '.github/CODEOWNERS' + - '.docs/CODEOWNERS' + +jobs: + trigger-maintainers-update: + name: Trigger updating MAINTAINERS.yaml because of CODEOWNERS change + runs-on: ubuntu-latest + + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # https://github.com/peter-evans/repository-dispatch/releases/tag/v3.0.0 + with: + # The PAT with the 'public_repo' scope is required + token: ${{ secrets.GH_TOKEN }} + repository: ${{ github.repository_owner }}/community + event-type: trigger-maintainers-update