Skip to content

Skip pushing branches with queued PRs#13

Merged
skarim merged 1 commit intomainfrom
skarim/skip-queued-prs
Apr 9, 2026
Merged

Skip pushing branches with queued PRs#13
skarim merged 1 commit intomainfrom
skarim/skip-queued-prs

Conversation

@skarim
Copy link
Copy Markdown
Collaborator

@skarim skarim commented Apr 8, 2026

Detect merge queue status via the GitHub GraphQL API's mergeQueueEntry field and temporarily skip queued branches in push, sync, and submit commands. Unlike merged state (which is persisted permanently), queued state is transient because PRs may or may not be merged. Each command run re-checks queue status from the API, so if a PR is ejected from the queue it becomes active again on next run.

Changes:

  • Add MergeQueueEntry to PullRequest GraphQL struct and PRDetails
  • Add IsQueued()/IsSkipped()/QueuedBranches() to stack model
  • Update ActiveBranches() family to exclude queued branches
  • Skip queued branches in push, sync (rebase + push), and submit
  • Add queued icon, style, and QUEUED state label in TUI view
  • Add comprehensive tests for queued state handling

Closes github/pull-requests#24019

Copilot AI review requested due to automatic review settings April 8, 2026 23:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds merge-queue awareness so branches whose PRs are currently in GitHub’s merge queue are treated as temporarily “skipped” (similar to merged) across the CLI/TUI, and excluded from push/sync/submit workflows.

Changes:

  • Extend GitHub GraphQL PR models to detect queued state via mergeQueueEntry, and propagate queued flags into stack state (transient, non-persisted).
  • Update stack model helpers (IsQueued/IsSkipped, QueuedBranches, ActiveBranches family) and command behavior to skip queued branches.
  • Update TUI/CLI rendering to show queued state (icon/label/separators) and add tests for queued handling.
Show a summary per file
File Description
internal/tui/stackview/styles.go Add queued icon and queued-specific styles.
internal/tui/stackview/model.go Render queued separators/labels/icons and adjust layout calculations for queued state.
internal/tui/stackview/model_test.go Add TUI tests for queued count and queued label rendering.
internal/stack/stack.go Add queued/skipped helpers and exclude queued branches from “active” calculations.
internal/stack/stack_test.go Add unit tests for queued behavior and non-persistence.
internal/github/github.go Query/derive merge-queue status and expose it via PR models/details.
internal/github/github_test.go Add test for PullRequest.IsQueued().
go.mod Promote golang.org/x/sys to a direct dependency (used behind build tags).
cmd/view.go Show queued separator/icon in --short output and include queued in JSON output.
cmd/view_test.go Add tests validating queued output and ordering with merged.
cmd/utils.go Populate transient BranchRef.Queued during PR sync.
cmd/sync.go Skip queued branches during rebase/push reporting.
cmd/submit.go Attempt to skip queued branches during submit flow.
cmd/push.go Sync PR state first and skip queued branches during push.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

cmd/sync.go:250

  • The “no branches” message in Step 4 still says "(all merged)" even though queued branches are now excluded from branches := activeBranchNames(s) and you print a queued skip count just above. Update the message to include queued (e.g., merged or queued) so output matches behavior.
	if len(branches) == 0 {
		cfg.Printf("No active branches to push (all merged)")
	} else {
  • Files reviewed: 14/14 changed files
  • Comments generated: 3

Comment thread cmd/submit.go
Comment thread internal/github/github.go Outdated
Comment thread internal/tui/stackview/model.go
Copy link
Copy Markdown

Copilot AI commented Apr 8, 2026

Warning

This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated!

Copilot thinks this PR is not ready to approve — see review comments for details.

Detect merge queue status via the GitHub GraphQL API's mergeQueueEntry
field and temporarily skip queued branches in push, sync, and submit
commands. Unlike merged state (which is persisted permanently), queued
state is transient — held in-memory only via a json:"-" tagged field
on BranchRef. Each command run re-checks queue status from the API, so
if a PR is ejected from the queue it becomes active again on next run.

Changes:
- Add MergeQueueEntry to PullRequest GraphQL struct and PRDetails
- Add IsQueued()/IsSkipped()/QueuedBranches() to stack model
- Update ActiveBranches() family to exclude queued branches
- Skip queued branches in push, sync (rebase + push), and submit
- Add queued icon, style, and QUEUED state label in TUI view
- Add comprehensive tests for queued state handling

Closes github/pull-requests#24019

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@skarim skarim force-pushed the skarim/skip-queued-prs branch from b2b1606 to dcb5885 Compare April 9, 2026 12:25
@skarim skarim merged commit 3912b44 into main Apr 9, 2026
7 checks passed
@skarim skarim deleted the skarim/skip-queued-prs branch April 9, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants