Skip to content

Commit 227ad03

Browse files
committed
Configure GitHub Actions workflows to use merge queue
Add support for the `merge_group` event trigger in the main Cobalt CI workflows (`main.yaml` and its callers: `aosp.yaml`, `linux.yaml`, `evergreen.yaml`, `tvos.yaml`, `raspi-2-modular.yaml`, `android.yaml`) and the `lint.yaml` workflow. Specifically: - Enable Docker image caching on `merge_group` events in `main.yaml`. - Set fetch depth to 2 for checkout on `merge_group` in `main.yaml` and `lint.yaml`. - Skip `check-bug-id` job in `lint.yaml` for `merge_group` events to avoid failures due to missing pull request context. - Restrict the `merge_group` trigger to the `main` branch across all workflows. TAG=agy CONV=3d0914e4-a97d-4965-b79b-db24090b185b
1 parent 4d99cdf commit 227ad03

8 files changed

Lines changed: 40 additions & 8 deletions

File tree

.github/workflows/android.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

.github/workflows/aosp.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

.github/workflows/evergreen.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

.github/workflows/lint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches:
1111
- main
1212
- feature/*
13+
merge_group:
14+
branches:
15+
- main
1316

1417
concurrency:
1518
group: ${{ github.workflow }}-${{ github.event_name }} @ ${{ github.event.label.name || github.event.pull_request.number || github.sha }} @ ${{ github.event.label.name && github.event.pull_request.number || github.event.action }}
@@ -54,6 +57,7 @@ jobs:
5457
pre-commit run --show-diff-on-failure --color=always --from-ref HEAD~1 --to-ref HEAD
5558
check-bug-id:
5659
name: Bug ID Check
60+
if: github.event_name != 'merge_group'
5761
runs-on: ubuntu-latest
5862
steps:
5963
- name: Bug ID Check

.github/workflows/linux.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

.github/workflows/main.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ jobs:
340340
uses: ./.github/actions/docker
341341
with:
342342
docker_service: ${{ needs.initialize.outputs.docker_service }}
343-
is_pr: ${{ (github.event_name == 'pull_request') }}
343+
is_pr: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
344344
docker_content_sha: ${{ needs.initialize.outputs.docker_content_sha }}
345345
github_token: ${{ secrets.GITHUB_TOKEN }}
346346
outputs:
@@ -363,7 +363,7 @@ jobs:
363363
uses: ./.github/actions/docker
364364
with:
365365
docker_service: unittest
366-
is_pr: ${{ (github.event_name == 'pull_request') }}
366+
is_pr: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
367367
docker_content_sha: ${{ needs.initialize.outputs.docker_content_sha }}
368368
github_token: ${{ secrets.GITHUB_TOKEN }}
369369
outputs:
@@ -386,7 +386,7 @@ jobs:
386386
uses: ./.github/actions/docker
387387
with:
388388
docker_service: webtest
389-
is_pr: ${{ (github.event_name == 'pull_request') }}
389+
is_pr: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
390390
docker_content_sha: ${{ needs.initialize.outputs.docker_content_sha }}
391391
github_token: ${{ secrets.GITHUB_TOKEN }}
392392
outputs:
@@ -463,7 +463,10 @@ jobs:
463463
# Set fetch-depth to 2 to make checkout faster for pull requests and cobalt_sandbox repo.
464464
# Set fetch-dept to 0 for non pull request workflows in production repo which is needed
465465
# to properly calculate build id.
466-
fetch_depth: ${{ ( github.event_name == 'pull_request' || github.repository == 'youtube/cobalt_sandbox' ) && 2 || 0 }}
466+
fetch_depth: >-
467+
${{ (github.event_name == 'pull_request' ||
468+
github.event_name == 'merge_group' ||
469+
github.repository == 'youtube/cobalt_sandbox') && 2 || 0 }}
467470
use_cache: true
468471

469472
- name: Set Up Depot Tools
@@ -511,7 +514,8 @@ jobs:
511514
if: |
512515
needs.initialize.outputs.test_on_device == 'true' &&
513516
(
514-
(github.event_name == 'pull_request' && github.event.pull_request.draft == false ) ||
517+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
518+
github.event_name == 'merge_group' ||
515519
((inputs.nightly == 'true' || github.event_name == 'schedule') && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
516520
(github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False')
517521
)
@@ -560,7 +564,8 @@ jobs:
560564
if: |
561565
needs.initialize.outputs.test_e2e == 'true' &&
562566
(
563-
(github.event_name == 'pull_request' && github.event.pull_request.draft == false ) ||
567+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
568+
github.event_name == 'merge_group' ||
564569
((inputs.nightly == 'true' || github.event_name == 'schedule') && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
565570
(github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False')
566571
)
@@ -595,7 +600,8 @@ jobs:
595600
if: |
596601
needs.initialize.outputs.test_yts == 'true' &&
597602
(
598-
(github.event_name == 'pull_request' && github.event.pull_request.draft == false ) ||
603+
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
604+
github.event_name == 'merge_group' ||
599605
((inputs.nightly == 'true' || github.event_name == 'schedule') && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
600606
(github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False')
601607
)
@@ -658,6 +664,7 @@ jobs:
658664
needs.initialize.outputs.test_on_host == 'true' &&
659665
(
660666
github.event_name == 'pull_request' ||
667+
github.event_name == 'merge_group' ||
661668
((inputs.nightly == 'true' || github.event_name == 'schedule') && vars.RUN_ODT_TESTS_ON_NIGHTLY != 'False') ||
662669
(github.event_name == 'push' && vars.RUN_ODT_TESTS_ON_POSTSUBMIT != 'False')
663670
)
@@ -815,7 +822,10 @@ jobs:
815822
with:
816823
path: cobalt/src
817824
ref: ${{ github.sha }}
818-
fetch_depth: ${{ ( github.event_name == 'pull_request' || github.repository == 'youtube/cobalt_sandbox' ) && 2 || 0 }}
825+
fetch_depth: >-
826+
${{ (github.event_name == 'pull_request' ||
827+
github.event_name == 'merge_group' ||
828+
github.repository == 'youtube/cobalt_sandbox') && 2 || 0 }}
819829
use_cache: true
820830

821831
- name: Set Up Depot Tools

.github/workflows/raspi-2-modular.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

.github/workflows/tvos.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- main
1313
- experimental/*
1414
- feature/*
15+
merge_group:
16+
branches:
17+
- main
1518
workflow_dispatch:
1619
inputs:
1720
nightly:

0 commit comments

Comments
 (0)