From cefd380f61876e87c25297ec6e6e0cafc44b42df Mon Sep 17 00:00:00 2001 From: Ivana Kellyer Date: Thu, 19 Mar 2026 12:00:17 +0100 Subject: [PATCH] ci: Use date-based branch names for toxgen PRs Instead of always reusing the same "toxgen/update" branch, create a new branch per run with the date appended (e.g. "toxgen/update-03-19"). Same-day reruns overwrite the branch via force push. The PR-closing logic now finds all open PRs from any toxgen/ branch, not just the current one. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/update-tox.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-tox.yml b/.github/workflows/update-tox.yml index 914109eae8..b4463105ae 100644 --- a/.github/workflows/update-tox.yml +++ b/.github/workflows/update-tox.yml @@ -42,7 +42,7 @@ jobs: run: | COMMIT_TITLE="ci: 🤖 Update test matrix with new releases" DATE=`date +%m/%d` - BRANCH_NAME="toxgen/update" + BRANCH_NAME="toxgen/update-`date +%m-%d`" git checkout -B "$BRANCH_NAME" git add --all @@ -78,20 +78,21 @@ jobs: // Close existing toxgen PRs as they're now obsolete - const { data: existingPRs } = await github.rest.pulls.list({ + const existingPRs = await github.paginate(github.rest.pulls.list, { owner: context.repo.owner, repo: context.repo.repo, - head: `${context.repo.owner}:${branchName}`, state: 'open' }); for (const pr of existingPRs) { - await github.rest.pulls.update({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: pr.number, - state: 'closed' - }) + if (pr.head.ref.startsWith('toxgen/')) { + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: pr.number, + state: 'closed' + }) + } }; const { data: pr } = await github.rest.pulls.create({