This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 245304d6bf5 Skip the ready-for-review CI run when the head already
passed (#77118)
245304d6bf5 is described below
commit 245304d6bf57b73a8467de75beb4f75f7004d666
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sun Nov 15 13:59:27 2026 +0100
Skip the ready-for-review CI run when the head already passed (#77118)
Draft pull requests already get CI when they are opened and pushed to, so
marking one ready for review repeats a full Tests (AMD) run on a head that
was tested and passed. The `ready_for_review` trigger is still needed for
pull requests whose runs never passed, such as the scheduled CI upgrade
pull requests that maintainers undraft to get a fresh run.
Generated-by: Claude Opus 5
Claude-Session: https://claude.ai/code/session_01NyQq9TvfJuBFXZg3jrCSZW
---
.github/workflows/ci-amd.yml | 34 ++++++++++++++++++++++++++++++++--
.github/workflows/ci-arm.yml | 34 ++++++++++++++++++++++++++++++++--
dev/breeze/doc/ci/05_workflows.md | 9 +++++++++
3 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/ci-amd.yml b/.github/workflows/ci-amd.yml
index 33ff3aff9ab..840e1c7df03 100644
--- a/.github/workflows/ci-amd.yml
+++ b/.github/workflows/ci-amd.yml
@@ -81,7 +81,8 @@ jobs:
name: "Check if the run is needed"
# A scheduled canary is not needed when the last completed full run of
this workflow on the
# branch tested the same commit and succeeded: it would only repeat that
run. A push run tests
- # the changes since the last successful run of this workflow on the
branch, found here.
+ # the changes since the last successful run of this workflow on the
branch, found here. Marking
+ # a draft pull request ready is not needed when its head already has a
passing `CI passed`.
# This job runs for every event, with no steps for the others: every other
job depends on it
# through `build-info`, and GitHub skips the whole dependency chain below
a skipped job unless
# each job in it has a status function such as `always()` in its `if:`.
@@ -89,12 +90,41 @@ jobs:
timeout-minutes: 5
permissions:
actions: read
+ checks: read
contents: read
outputs:
- run-needed: ${{ steps.schedule.outputs.run-needed || 'true' }}
+ run-needed: ${{ steps.schedule.outputs.run-needed ||
steps.ready.outputs.run-needed || 'true' }}
# Empty in forks, whose pushes selective checks compare against
apache/airflow.
push-base-commit: ${{ steps.push.outputs.push-base-commit }}
steps:
+ - name: "Check the earlier runs of the pull request's head"
+ if: github.event_name == 'pull_request' && github.event.action ==
'ready_for_review'
+ id: ready
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ REPOSITORY: ${{ github.repository }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ set -euo pipefail
+ # Draft pull requests get CI on `opened` and `synchronize`, so
marking one ready usually
+ # repeats a run that already passed. Only a job that ran as `CI
passed` counts: a gate-only
+ # run, a run skipped here and a cancelled run all succeed under
another name of the job,
+ # and they did not test the head. A head whose runs failed, were
cancelled or wait for
+ # approval, such as a scheduled CI upgrade pull request's, is tested
in full.
+ if ! passed="$(gh api
"repos/${REPOSITORY}/commits/${HEAD_SHA}/check-runs" -X GET \
+ -f check_name="CI passed" -f filter=latest -F per_page=100 \
+ --jq '[.check_runs[] | select(.conclusion ==
"success")][0].html_url // ""')"; then
+ # Fail open: a failed lookup must not skip the run.
+ echo "::warning::Could not check the earlier runs of ${HEAD_SHA},
running CI"
+ passed=""
+ fi
+ if [[ -n "${passed}" ]]; then
+ echo "run-needed=false" >> "${GITHUB_OUTPUT}"
+ echo "The head of the pull request already passed CI: ${passed}"
>> "${GITHUB_STEP_SUMMARY}"
+ else
+ echo "run-needed=true" >> "${GITHUB_OUTPUT}"
+ fi
- name: "Find the last successful run of the branch"
if: github.event_name == 'push' && github.repository ==
'apache/airflow'
id: push
diff --git a/.github/workflows/ci-arm.yml b/.github/workflows/ci-arm.yml
index d719834a287..14f5d4ed8e2 100644
--- a/.github/workflows/ci-arm.yml
+++ b/.github/workflows/ci-arm.yml
@@ -60,7 +60,8 @@ jobs:
name: "Check if the run is needed"
# A scheduled canary is not needed when the last completed full run of
this workflow on the
# branch tested the same commit and succeeded: it would only repeat that
run. A push run tests
- # the changes since the last successful run of this workflow on the
branch, found here.
+ # the changes since the last successful run of this workflow on the
branch, found here. Marking
+ # a draft pull request ready is not needed when its head already has a
passing `CI passed`.
# This job runs for every event, with no steps for the others: every other
job depends on it
# through `build-info`, and GitHub skips the whole dependency chain below
a skipped job unless
# each job in it has a status function such as `always()` in its `if:`.
@@ -68,12 +69,41 @@ jobs:
timeout-minutes: 5
permissions:
actions: read
+ checks: read
contents: read
outputs:
- run-needed: ${{ steps.schedule.outputs.run-needed || 'true' }}
+ run-needed: ${{ steps.schedule.outputs.run-needed ||
steps.ready.outputs.run-needed || 'true' }}
# Empty in forks, whose pushes selective checks compare against
apache/airflow.
push-base-commit: ${{ steps.push.outputs.push-base-commit }}
steps:
+ - name: "Check the earlier runs of the pull request's head"
+ if: github.event_name == 'pull_request' && github.event.action ==
'ready_for_review'
+ id: ready
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ REPOSITORY: ${{ github.repository }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ set -euo pipefail
+ # Draft pull requests get CI on `opened` and `synchronize`, so
marking one ready usually
+ # repeats a run that already passed. Only a job that ran as `CI
passed` counts: a gate-only
+ # run, a run skipped here and a cancelled run all succeed under
another name of the job,
+ # and they did not test the head. A head whose runs failed, were
cancelled or wait for
+ # approval, such as a scheduled CI upgrade pull request's, is tested
in full.
+ if ! passed="$(gh api
"repos/${REPOSITORY}/commits/${HEAD_SHA}/check-runs" -X GET \
+ -f check_name="CI passed" -f filter=latest -F per_page=100 \
+ --jq '[.check_runs[] | select(.conclusion ==
"success")][0].html_url // ""')"; then
+ # Fail open: a failed lookup must not skip the run.
+ echo "::warning::Could not check the earlier runs of ${HEAD_SHA},
running CI"
+ passed=""
+ fi
+ if [[ -n "${passed}" ]]; then
+ echo "run-needed=false" >> "${GITHUB_OUTPUT}"
+ echo "The head of the pull request already passed CI: ${passed}"
>> "${GITHUB_STEP_SUMMARY}"
+ else
+ echo "run-needed=true" >> "${GITHUB_OUTPUT}"
+ fi
- name: "Find the last successful run of the branch"
if: github.event_name == 'push' && github.repository ==
'apache/airflow'
id: push
diff --git a/dev/breeze/doc/ci/05_workflows.md
b/dev/breeze/doc/ci/05_workflows.md
index 7b29cc1d431..ad967d30b89 100644
--- a/dev/breeze/doc/ci/05_workflows.md
+++ b/dev/breeze/doc/ci/05_workflows.md
@@ -68,6 +68,15 @@ for these builds, we only execute Python tests if
significant files have
changed. For instance, if the PR involves a "no-code" change, no tests
will be executed.
+Draft PRs get these runs too, on `opened` and `synchronize`. Marking a draft
+ready for review starts another run, which finishes at once when the head of
+the PR already has a passing `CI passed` check: its first job, `Check if the
run
+is needed`, finds that check and every other job is skipped. The earlier
+`CI passed` stays on the commit, so the PR can merge on it. When there is no
+passing `CI passed` for the head, the run tests it in full. That is how a PR
whose
+earlier runs failed, were cancelled or still wait for approval, such as the
+scheduled CI upgrade PRs, gets a fresh run when a maintainer marks it ready.
+
Regular PR builds run in a "stable" environment:
- fixed set of constraints (constraints that passed the tests) - except