Skip to content

Commit be179a5

Browse files
fix(ci): skip source-only checks on queue candidates (#10971)
* fix(ci): keep source policy off queue candidates * fix(ci): skip duplicate merge queue workflows
1 parent 0acd6c6 commit be179a5

4 files changed

Lines changed: 64 additions & 10 deletions

File tree

.github/workflows/pr-gate.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Required PR gate verifying that a PR's conventional-commit declaration is consistent with its code and changelog entries; changelog drafting lives in changelog-command.yml.
1+
# Required source-PR gate verifying that a conventional-commit declaration is consistent with its code and changelog entries.
2+
# Mergify queue candidates skip these policy jobs because their generated metadata does not describe a source change.
23
name: PR Gate
34

45
on:
@@ -32,23 +33,40 @@ jobs:
3233
runs-on: ubuntu-latest
3334
timeout-minutes: 5
3435
outputs:
36+
queue_candidate: ${{ steps.classify.outputs.queue_candidate || 'false' }}
3537
semver: ${{ steps.filter.outputs.semver || 'true' }}
3638
breaking: ${{ steps.title.outputs.breaking }}
3739
type: ${{ steps.title.outputs.type }}
3840
conventional: ${{ steps.title.outputs.conventional }}
3941
steps:
40-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42+
- name: Identify Mergify queue candidates
43+
id: classify
4144
if: github.event_name == 'pull_request'
45+
env:
46+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
47+
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
48+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
49+
REPOSITORY: ${{ github.repository }}
50+
run: |
51+
queue_candidate=false
52+
if [[ "$PR_AUTHOR" == "mergify[bot]" ]] &&
53+
[[ "$HEAD_REPOSITORY" == "$REPOSITORY" ]] &&
54+
[[ "$HEAD_REF" == mergify/merge-queue/* ]]; then
55+
queue_candidate=true
56+
fi
57+
echo "queue_candidate=$queue_candidate" >> "$GITHUB_OUTPUT"
58+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59+
if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true'
4260
with:
4361
persist-credentials: false
4462
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
4563
id: filter
46-
if: github.event_name == 'pull_request'
64+
if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true'
4765
with:
4866
filters: .github/path-filters.yml
4967
- name: Read the declaration from the PR title
5068
id: title
51-
if: github.event_name == 'pull_request'
69+
if: github.event_name == 'pull_request' && steps.classify.outputs.queue_candidate != 'true'
5270
env:
5371
PR_TITLE: ${{ github.event.pull_request.title }}
5472
run: |
@@ -78,9 +96,13 @@ jobs:
7896
7997
semver-checks:
8098
needs: changes
81-
# Real work runs only on pull requests that change Rust and do not already declare a break
82-
# with `!`. A declared break is allowed through; release-plz majors the version at release.
83-
if: github.event_name == 'pull_request' && needs.changes.outputs.semver == 'true' && needs.changes.outputs.breaking == 'false'
99+
# Real work runs only on contributor pull requests that change Rust and do not already declare
100+
# a break with `!`. A declared break is allowed through; release-plz majors the version at release.
101+
if: >-
102+
github.event_name == 'pull_request' &&
103+
needs.changes.outputs.queue_candidate != 'true' &&
104+
needs.changes.outputs.semver == 'true' &&
105+
needs.changes.outputs.breaking == 'false'
84106
runs-on: ubuntu-latest
85107
timeout-minutes: 45
86108
steps:
@@ -109,7 +131,9 @@ jobs:
109131

110132
changelog-gate:
111133
needs: changes
112-
if: github.event_name == 'pull_request'
134+
if: >-
135+
github.event_name == 'pull_request' &&
136+
needs.changes.outputs.queue_candidate != 'true'
113137
runs-on: ubuntu-latest
114138
timeout-minutes: 5
115139
steps:

.github/workflows/test-docker.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ env:
2727

2828
jobs:
2929
changes:
30+
# Docker validation runs on source PRs, not temporary Mergify queue candidates.
31+
if: >-
32+
${{
33+
github.event_name != 'pull_request' ||
34+
github.event.pull_request.user.login != 'mergify[bot]' ||
35+
github.event.pull_request.head.repo.full_name != github.repository ||
36+
!startsWith(github.event.pull_request.head.ref, 'mergify/merge-queue/')
37+
}}
3038
runs-on: ubuntu-latest
3139
timeout-minutes: 5
3240
outputs:
@@ -210,7 +218,7 @@ jobs:
210218
211219
test-docker:
212220
runs-on: ubuntu-latest
213-
if: always()
221+
if: always() && needs.changes.result != 'skipped'
214222
needs:
215223
- changes
216224
- build-docker-image

.github/workflows/trigger-integration-tests.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,21 @@ jobs:
3838
# Fork PRs do not receive repository secrets on pull_request events.
3939
# Skip the job on fork PRs; maintainers can still run it manually via
4040
# workflow_dispatch with the PR number as input.
41-
if: ${{ (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch' }}
41+
# Mergify queue candidates reuse the source PR's integration result.
42+
if: >-
43+
${{
44+
(
45+
github.event_name != 'pull_request' ||
46+
github.event.pull_request.user.login != 'mergify[bot]' ||
47+
github.event.pull_request.head.repo.full_name != github.repository ||
48+
!startsWith(github.event.pull_request.head.ref, 'mergify/merge-queue/')
49+
) &&
50+
(
51+
(github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) ||
52+
(github.event_name == 'push' && github.ref_name == 'main') ||
53+
github.event_name == 'workflow_dispatch'
54+
)
55+
}}
4256
runs-on: ubuntu-latest
4357
permissions:
4458
# Needed to post a sticky comment on the PR when triggered manually.

.github/workflows/zfnd-deploy-nodes-gcp.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ jobs:
136136
# the trigger. Downstream jobs read `set-matrix` outputs so the event →
137137
# environment mapping is computed once.
138138
set-matrix:
139+
# Deployment image tests run on source PRs, not temporary Mergify queue candidates.
140+
if: >-
141+
${{
142+
github.event_name != 'pull_request' ||
143+
github.event.pull_request.user.login != 'mergify[bot]' ||
144+
github.event.pull_request.head.repo.full_name != github.repository ||
145+
!startsWith(github.event.pull_request.head.ref, 'mergify/merge-queue/')
146+
}}
139147
runs-on: ubuntu-latest
140148
outputs:
141149
networks: ${{ steps.set-matrix.outputs.networks }}

0 commit comments

Comments
 (0)