From 0dda5978a3a0dfef5ae65fd1e855967b0809f880 Mon Sep 17 00:00:00 2001 From: Dereck Lam Hon Wah Date: Tue, 22 Oct 2024 09:53:49 +0400 Subject: [PATCH] chore: add a workflow to trigger the workflow of another repo --- .../workflows/trigger_update_contributors.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/trigger_update_contributors.yml diff --git a/.github/workflows/trigger_update_contributors.yml b/.github/workflows/trigger_update_contributors.yml new file mode 100644 index 0000000..ac52a0d --- /dev/null +++ b/.github/workflows/trigger_update_contributors.yml @@ -0,0 +1,30 @@ +name: Trigger Update Contributors in frontend.mu + +on: + pull_request_target: + types: + - closed + push: + branches: + - main + +jobs: + trigger: + runs-on: ubuntu-latest + + steps: + - name: Trigger Update Contributors in frontend.mu website repository + run: | + # Set the required variables + target_repo_owner="frontendmu" + target_repo_name="frontend.mu" + source_repo_name="${{ github.event.repository.name }}" + event_type="trigger-workflow" + + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.PAT }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/$target_repo_owner/$target_repo_name/dispatches \ + -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"source_repo\": \"$source_repo_name\", \"unit\": false, \"integration\": true}}"