From e9c9ce7ebb536b4fcad434fe9f40db80bbeee704 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 10:55:15 +0000 Subject: [PATCH 1/3] nightly: don't rebase package branches that have an open PR A force push re-triggers every workflow on the PR even when they passed and nothing conflicted. Only rebase when no PR is open; otherwise fast-forward. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01WLrKmVNbTh8QfP71a78k8b --- .github/workflows/nightly.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 16b499683fc3..9a19d481fcd8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -78,16 +78,27 @@ jobs: # Re-declare each package on the same package-specific branch used by # wheel publication. This preserves publication metadata already # waiting for review while keeping unrelated packages isolated. + # + # While a PR is open for the branch, build on top of it without + # rebasing: a force push re-triggers every workflow on the PR, even + # when they were passing and nothing conflicted. Only a branch with + # no open PR is rebased onto the current main. open_pr() { local package="$1" slug="$2" title="$3" local branch="package/$slug" pr pr_title="$slug: update packages" remote_sha="" + local push_args=() + + pr=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" --state open --json url --jq '.[0].url') || return 1 if git fetch --quiet origin "$branch" 2>/dev/null; then remote_sha=$(git rev-parse FETCH_HEAD) || return 1 git switch --force-create "$branch" "$remote_sha" || return 1 - if ! git rebase "$base"; then - git rebase --abort || true - return 1 + if [ -z "$pr" ]; then + if ! git rebase "$base"; then + git rebase --abort || true + return 1 + fi + push_args=(--force-with-lease="$branch:$remote_sha") fi else git switch --force-create "$branch" "$base" || return 1 @@ -98,7 +109,7 @@ jobs: if git diff --quiet -- docs/packages ci_scripts/packages.txt ci_scripts/deprecated.txt; then if [ -n "$remote_sha" ] && [ "$(git rev-parse HEAD)" != "$remote_sha" ]; then - git push --force-with-lease="$branch:$remote_sha" origin "$branch" || return 1 + git push "${push_args[@]}" origin "$branch" || return 1 fi echo "$package: nothing to declare" return 0 @@ -107,13 +118,8 @@ jobs: git add docs/packages ci_scripts/packages.txt ci_scripts/deprecated.txt || return 1 git commit -s -m "$title" || return 1 - if [ -n "$remote_sha" ]; then - git push --force-with-lease="$branch:$remote_sha" origin "$branch" || return 1 - else - git push origin "$branch" || return 1 - fi + git push "${push_args[@]}" origin "$branch" || return 1 - pr=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" --state open --json url --jq '.[0].url') || return 1 if [ -n "$pr" ]; then gh pr edit "$pr" --title "$pr_title" --body-file "$REPORTS/$slug.md" || return 1 echo "Updated $pr" From de192e8a74843bcdc063a883a6d79638e78929a8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 10:57:43 +0000 Subject: [PATCH 2/3] nightly: never rebase an existing package branch Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01WLrKmVNbTh8QfP71a78k8b --- .github/workflows/nightly.yml | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9a19d481fcd8..cce552b989e8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -79,27 +79,16 @@ jobs: # wheel publication. This preserves publication metadata already # waiting for review while keeping unrelated packages isolated. # - # While a PR is open for the branch, build on top of it without - # rebasing: a force push re-triggers every workflow on the PR, even - # when they were passing and nothing conflicted. Only a branch with - # no open PR is rebased onto the current main. + # An existing branch is built on as it is, never rebased: a force push + # re-triggers every workflow on its PR, even when they were passing + # and nothing conflicted. Conflicts with main are left to be fixed + # manually. open_pr() { local package="$1" slug="$2" title="$3" - local branch="package/$slug" pr pr_title="$slug: update packages" remote_sha="" - local push_args=() - - pr=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" --state open --json url --jq '.[0].url') || return 1 + X if git fetch --quiet origin "$branch" 2>/dev/null; then - remote_sha=$(git rev-parse FETCH_HEAD) || return 1 - git switch --force-create "$branch" "$remote_sha" || return 1 - if [ -z "$pr" ]; then - if ! git rebase "$base"; then - git rebase --abort || true - return 1 - fi - push_args=(--force-with-lease="$branch:$remote_sha") - fi + git switch --force-create "$branch" FETCH_HEAD || return 1 else git switch --force-create "$branch" "$base" || return 1 fi @@ -108,9 +97,6 @@ jobs: ci_scripts/check_versions.py --declare "$package" || return 1 if git diff --quiet -- docs/packages ci_scripts/packages.txt ci_scripts/deprecated.txt; then - if [ -n "$remote_sha" ] && [ "$(git rev-parse HEAD)" != "$remote_sha" ]; then - git push "${push_args[@]}" origin "$branch" || return 1 - fi echo "$package: nothing to declare" return 0 fi @@ -118,8 +104,9 @@ jobs: git add docs/packages ci_scripts/packages.txt ci_scripts/deprecated.txt || return 1 git commit -s -m "$title" || return 1 - git push "${push_args[@]}" origin "$branch" || return 1 + git push origin "$branch" || return 1 + pr=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" --state open --json url --jq '.[0].url') || return 1 if [ -n "$pr" ]; then gh pr edit "$pr" --title "$pr_title" --body-file "$REPORTS/$slug.md" || return 1 echo "Updated $pr" From 056224b10aa2eb2224d072aa06b32eab0ca86ffb Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 10:59:06 +0000 Subject: [PATCH 3/3] nightly: restore local declarations in open_pr Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01WLrKmVNbTh8QfP71a78k8b --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cce552b989e8..a1003ac84afd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -85,7 +85,7 @@ jobs: # manually. open_pr() { local package="$1" slug="$2" title="$3" - X + local branch="package/$slug" pr pr_title="$slug: update packages" if git fetch --quiet origin "$branch" 2>/dev/null; then git switch --force-create "$branch" FETCH_HEAD || return 1