Skip to content

Commit 715fd2b

Browse files
sentrivanaclaude
andauthored
ci: Use date-based branch names for toxgen PRs (#5704)
Reusing the `toxgen/update` branch can get annoying, especially since it needs manual babysitting (empty commit to trigger CI). Let's use distinct names instead. ## Summary - Instead of always reusing the same `toxgen/update` branch, the "Update test matrix" workflow now creates a date-based branch (e.g. `toxgen/update-03-19`). - Same-day reruns force-push to the same branch, so they overwrite rather than fail. - The PR-closing logic now finds and closes all open PRs from any `toxgen/` branch, not just the current one. ## Test plan - [ ] Trigger the "Update test matrix" workflow manually and verify it creates a branch like `toxgen/update-MM-DD` - [ ] Trigger it again on the same day and verify it overwrites the branch and closes the previous PR - [ ] Verify old toxgen PRs from different branches get closed Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 35fe9e4 commit 715fd2b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/workflows/update-tox.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
COMMIT_TITLE="ci: 🤖 Update test matrix with new releases"
4444
DATE=`date +%m/%d`
45-
BRANCH_NAME="toxgen/update"
45+
BRANCH_NAME="toxgen/update-`date +%m-%d`"
4646
4747
git checkout -B "$BRANCH_NAME"
4848
git add --all
@@ -78,20 +78,21 @@ jobs:
7878
7979
// Close existing toxgen PRs as they're now obsolete
8080
81-
const { data: existingPRs } = await github.rest.pulls.list({
81+
const existingPRs = await github.paginate(github.rest.pulls.list, {
8282
owner: context.repo.owner,
8383
repo: context.repo.repo,
84-
head: `${context.repo.owner}:${branchName}`,
8584
state: 'open'
8685
});
8786
8887
for (const pr of existingPRs) {
89-
await github.rest.pulls.update({
90-
owner: context.repo.owner,
91-
repo: context.repo.repo,
92-
pull_number: pr.number,
93-
state: 'closed'
94-
})
88+
if (pr.head.ref.startsWith('toxgen/')) {
89+
await github.rest.pulls.update({
90+
owner: context.repo.owner,
91+
repo: context.repo.repo,
92+
pull_number: pr.number,
93+
state: 'closed'
94+
})
95+
}
9596
};
9697
9798
const { data: pr } = await github.rest.pulls.create({

0 commit comments

Comments
 (0)