feat(actions): add branch filters to run list (#37826)

## Summary

- Add a Branch filter dropdown to the repo Actions run list web UI
- Wire `?branch=` query param through the web handler, matching the
existing REST API filter behavior
- Source the Branch dropdown from the indexed `branch` table (filtering
out deleted branches) instead of scanning `action_run.ref`, addressing
review feedback about unindexed columns

The Event filter was dropped after review: a static list of supported
events was noisy as UX, and querying distinct values from
`action_run.trigger_event` is slow because the column is not indexed.
`FindRunOptions.TriggerEvent` is kept for the REST API.

Closes #25042

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Nicolas
2026-05-26 11:08:05 +02:00
committed by GitHub
parent 4a6db5a7c2
commit a03e0364eb
7 changed files with 140 additions and 13 deletions
+14
View File
@@ -132,6 +132,20 @@ func GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInf
return statusInfoList
}
// GetRunBranches returns branch names for the run-list "Branch" filter.
// Sourced from the `branch` table (indexed by repo_id) rather than DISTINCT-ing
// `action_run.ref`, which is wildcard-matched and slow on large repos; as a side
// effect the list reflects existing branches, not only ones that produced a run.
func GetRunBranches(ctx context.Context, repoID int64) ([]string, error) {
branches := make([]string, 0, 10)
return branches, db.GetEngine(ctx).Table("branch").
Where("repo_id = ?", repoID).
And("is_deleted = ?", false).
Cols("name").
OrderBy("name ASC").
Find(&branches)
}
// GetRunWorkflowIDs returns all distinct WorkflowIDs that have at least
// one ActionRun in the given repo.
func GetRunWorkflowIDs(ctx context.Context, repoID int64) ([]string, error) {