[PR #9071] [MERGED] fix(ci): prevent label explosion on PRs targeting the next branch #16663

Closed
opened 2026-04-13 10:38:08 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/9071
Author: @gustavovalverde
Created: 4/9/2026
Status: Merged
Merged: 4/9/2026
Merged by: @gustavovalverde

Base: mainHead: worktree-fix-auto-label-next-branch


📝 Commits (2)

  • 934749e fix(ci): prevent label explosion on PRs targeting the next branch
  • 6f69b41 fix(ci): ensure devops label on existing sync PRs

📊 Changes

2 files changed (+9 additions, -1 deletions)

View changed files

📝 .github/workflows/auto-label.yml (+7 -1)
📝 .github/workflows/release.yml (+2 -0)

📄 Description

Summary

The auto-labeler computes its diff against the PR's base branch. Three scenarios cause it to apply nearly every label in the repo:

  1. Retargeted PRsauto-retarget.yml moves the base from main to next when a changeset declares a minor/major bump. Because next has diverged from main, the diff now includes hundreds of files the author never touched, triggering most label rules.
  2. Direct-to-next PRs — Same large diff problem for any PR opened directly against next.
  3. Bot sync PRs — The chore: sync main to next PR created by better-release[bot] carries every file that diverged between the two branches.

Since sync-labels: false means labels only accumulate (never removed), the incorrect labels persist permanently.

Changes

  • auto-label.yml: skip the labeler when base.ref == next or when the actor is better-release[bot]
  • release.yml: tag sync PRs with the devops label at creation time, since the labeler will no longer run for them

Retargeted PRs keep their correct labels from the initial opened event (when base was still main). No labels are lost.

Test plan

  • Open a PR with a minor changeset → verify it gets retargeted to next and keeps only the labels from the initial run
  • Push a new commit to a retargeted PR → verify no new labels are added
  • Merge to main to trigger a sync PR → verify it gets only the devops label

Summary by cubic

Prevent label explosion on PRs targeting the next branch and on sync PRs by better-release[bot]. We skip the auto-labeler in those cases and always tag sync PRs with the devops label, including existing sync PRs.

  • Bug Fixes
    • In .github/workflows/auto-label.yml, skip the label job when base is next or actor is better-release[bot].
    • In .github/workflows/release.yml, ensure sync PRs have devops: add --label devops on create and gh pr edit ... --add-label devops when a sync PR already exists.

Written for commit 6f69b41cd8. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/9071 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 4/9/2026 **Status:** ✅ Merged **Merged:** 4/9/2026 **Merged by:** [@gustavovalverde](https://github.com/gustavovalverde) **Base:** `main` ← **Head:** `worktree-fix-auto-label-next-branch` --- ### 📝 Commits (2) - [`934749e`](https://github.com/better-auth/better-auth/commit/934749e9c6c504cf3f3c055bd5ea33f4421111c8) fix(ci): prevent label explosion on PRs targeting the next branch - [`6f69b41`](https://github.com/better-auth/better-auth/commit/6f69b41cd8eacb23cfd5af347308427b4420c64a) fix(ci): ensure devops label on existing sync PRs ### 📊 Changes **2 files changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/auto-label.yml` (+7 -1) 📝 `.github/workflows/release.yml` (+2 -0) </details> ### 📄 Description ## Summary The auto-labeler computes its diff against the PR's base branch. Three scenarios cause it to apply nearly every label in the repo: 1. **Retargeted PRs** — `auto-retarget.yml` moves the base from `main` to `next` when a changeset declares a minor/major bump. Because `next` has diverged from `main`, the diff now includes hundreds of files the author never touched, triggering most label rules. 2. **Direct-to-next PRs** — Same large diff problem for any PR opened directly against `next`. 3. **Bot sync PRs** — The `chore: sync main to next` PR created by `better-release[bot]` carries every file that diverged between the two branches. Since `sync-labels: false` means labels only accumulate (never removed), the incorrect labels persist permanently. ## Changes - **`auto-label.yml`**: skip the labeler when `base.ref == next` or when the actor is `better-release[bot]` - **`release.yml`**: tag sync PRs with the `devops` label at creation time, since the labeler will no longer run for them Retargeted PRs keep their correct labels from the initial `opened` event (when base was still `main`). No labels are lost. ## Test plan - [ ] Open a PR with a minor changeset → verify it gets retargeted to `next` and keeps only the labels from the initial run - [ ] Push a new commit to a retargeted PR → verify no new labels are added - [ ] Merge to `main` to trigger a sync PR → verify it gets only the `devops` label <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Prevent label explosion on PRs targeting the next branch and on sync PRs by `better-release[bot]`. We skip the auto-labeler in those cases and always tag sync PRs with the `devops` label, including existing sync PRs. - **Bug Fixes** - In `.github/workflows/auto-label.yml`, skip the label job when base is `next` or actor is `better-release[bot]`. - In `.github/workflows/release.yml`, ensure sync PRs have `devops`: add `--label devops` on create and `gh pr edit ... --add-label devops` when a sync PR already exists. <sup>Written for commit 6f69b41cd8eacb23cfd5af347308427b4420c64a. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:38:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16663