From 3a8eb96d76ac4449f8afb2b9f05b74dfa0fccc70 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Wed, 20 Aug 2025 21:12:16 +0100 Subject: [PATCH] Dispatch github ci jobs after running update-vrt workflow (#5586) * Enhance CI workflows to support repository dispatch events and improve branch handling - Added support for `repository_dispatch` events in build, check, and codeql workflows. - Updated concurrency group to include `client_payload.pr_number` for better context. - Modified checkout steps to reference the correct branch from `client_payload` if available. * Add release notes for PR #5586 --------- Co-authored-by: github-actions[bot] --- .github/workflows/build.yml | 12 +++++++++++- .github/workflows/check.yml | 14 +++++++++++++- .github/workflows/codeql.yml | 6 +++++- .github/workflows/update-vrt.yml | 11 +++++++++++ upcoming-release-notes/5586.md | 7 +++++++ 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 upcoming-release-notes/5586.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 955580ac7a..9a71995753 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,11 @@ on: branches: - master pull_request: + repository_dispatch: + types: [vrt_updated] concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.client_payload.pr_number || github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: @@ -22,6 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Build API @@ -38,6 +42,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Build CRDT @@ -54,6 +60,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Build Web @@ -73,6 +81,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Build Server diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c7ebd00a7e..dd5c76a088 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,9 +5,11 @@ on: branches: - master pull_request: + repository_dispatch: + types: [vrt_updated] concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.client_payload.pr_number || github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: @@ -15,6 +17,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Lint @@ -23,6 +27,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Typecheck @@ -31,6 +37,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Build Web @@ -41,6 +49,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Set up environment uses: ./.github/actions/setup - name: Test @@ -51,6 +61,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - uses: actions/setup-node@v4 with: node-version: 20 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 20780a5625..a031eb726a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -4,11 +4,13 @@ on: push: branches: [master] pull_request: + repository_dispatch: + types: [vrt_updated] schedule: - cron: '23 11 * * 6' concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.client_payload.pr_number || github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} jobs: @@ -23,6 +25,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.client_payload.branch || github.ref }} - name: Initialize CodeQL uses: github/codeql-action/init@v3 diff --git a/.github/workflows/update-vrt.yml b/.github/workflows/update-vrt.yml index ccb19f6375..5304592fb2 100644 --- a/.github/workflows/update-vrt.yml +++ b/.github/workflows/update-vrt.yml @@ -96,6 +96,17 @@ jobs: fi git commit -m "Update VRT" git push origin HEAD:${BRANCH_NAME} + - name: Trigger CI workflows + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + event-type: vrt_updated + client-payload: | + { + "pr_number": "${{ github.event.issue.number }}", + "branch": "${{ steps.comment-branch.outputs.head_ref }}", + "sha": "${{ steps.comment-branch.outputs.head_sha }}" + } - name: Add finished reaction uses: dkershner6/reaction-action@v2 with: diff --git a/upcoming-release-notes/5586.md b/upcoming-release-notes/5586.md new file mode 100644 index 0000000000..17d0f0d5e5 --- /dev/null +++ b/upcoming-release-notes/5586.md @@ -0,0 +1,7 @@ +--- +category: Enhancements +authors: [MatissJanis] +--- + +Add repository dispatch trigger to CI workflows for improved downstream job execution. +