Skip to content

Commit 1731583

Browse files
authored
ci: Enable GitHub Merge Queue support (#5209)
1 parent 7fab34d commit 1731583

6 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/changelog.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
types: [opened, synchronize, reopened, labeled, unlabeled]
1010
branches:
1111
- main
12+
merge_group:
1213

1314
permissions:
1415
contents: read
@@ -17,6 +18,7 @@ jobs:
1718
changelog:
1819
runs-on: ubuntu-latest
1920
if: |
21+
github.event_name != 'merge_group' &&
2022
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog')
2123
&& github.actor != 'otelbot[bot]'
2224

.github/workflows/check-links.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,24 @@ on:
1313
- '**/*.rst'
1414
- '.github/workflows/check-links.yml'
1515
- '.github/workflows/check_links_config.json'
16+
merge_group:
17+
paths:
18+
- '**/*.md'
19+
- '**/*.rst'
20+
- '.github/workflows/check-links.yml'
21+
- '.github/workflows/check_links_config.json'
1622

1723
permissions:
1824
contents: read
1925

2026
concurrency:
21-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
27+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }}
2228
cancel-in-progress: true
2329

30+
env:
31+
# Diff against merge group SHAs in queue, or PR base branch otherwise
32+
DIFF_RANGE: ${{ github.event_name == 'merge_group' && format('{0}...{1}', github.event.merge_group.base_sha, github.event.merge_group.head_sha) || format('origin/{0}...HEAD', github.base_ref) }}
33+
2434
jobs:
2535
check-links:
2636
runs-on: ubuntu-latest
@@ -53,14 +63,14 @@ jobs:
5363
${{ steps.changed-files.outputs.all_changed_files }} \
5464
|| { echo "Check that anchor links are lowercase"; exit 1; }
5565
56-
- name: Check new links only on pull requests
57-
if: steps.changed-files.outputs.any_changed == 'true' && github.event_name == 'pull_request'
66+
- name: Check new links only on pull requests and merge groups
67+
if: steps.changed-files.outputs.any_changed == 'true' && (github.event_name == 'pull_request' || github.event_name == 'merge_group')
5868
run: |
5969
# Extract URLs only from added lines in the diff to avoid
6070
# rate limiting when checking all links in large files like
6171
# CHANGELOG.md. Only new/changed links are checked on PRs;
6272
# pushes to main still check all links in changed files.
63-
git diff "origin/${{ github.base_ref }}...HEAD" -- \
73+
git diff "$DIFF_RANGE" -- \
6474
${{ steps.changed-files.outputs.all_changed_files }} \
6575
| grep '^+' | grep -v '^+++' \
6676
| grep -oP 'https?://[^\s\)\]\"'"'"'`>]+' \

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches:
99
- 'main'
1010
pull_request:
11+
merge_group:
1112

1213
permissions:
1314
contents: read

.github/workflows/misc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ jobs:
9898
runs-on: ubuntu-latest
9999
timeout-minutes: 30
100100
if: |
101-
github.event.pull_request.user.login != 'otelbot[bot]' && github.event_name == 'pull_request'
101+
github.event_name == 'merge_group' ||
102+
(github.event_name == 'pull_request' &&
103+
github.event.pull_request.user.login != 'otelbot[bot]')
102104
steps:
103105
- name: Checkout repo @ SHA - ${{ github.sha }}
104106
uses: actions/checkout@v4

.github/workflows/templates/ci.yml.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches:
99
- 'main'
1010
pull_request:
11+
merge_group:
1112

1213
permissions:
1314
contents: read

.github/workflows/templates/misc.yml.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ jobs:
4646
{%- endif %}
4747
{%- if job_data == "docs" %}
4848
if: |
49-
github.event.pull_request.user.login != 'otelbot[bot]' && github.event_name == 'pull_request'
49+
github.event_name == 'merge_group' ||
50+
(github.event_name == 'pull_request' &&
51+
github.event.pull_request.user.login != 'otelbot[bot]')
5052
{%- endif %}
5153
steps:
5254
- name: Checkout repo @ SHA - ${% raw %}{{ github.sha }}{% endraw %}

0 commit comments

Comments
 (0)