mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-14 03:29:55 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user