feat(api): add tag_filter query parameter to release list API (#38681)

Adds a `tag_filter` query parameter to `GET /repos/{owner}/{repo}/releases` that filters releases by tag name, with `*` as a wildcard (e.g. `v1*`, `*beta`, `*rc*`). Matching is
case-insensitive and done in the database query. Literal `%`, `_` and `\` in the filter are escaped.

Fixes: https://github.com/go-gitea/gitea/issues/38513
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Mitrahsoft
2026-07-31 16:10:17 +05:30
committed by GitHub
parent a30d865b78
commit bcf45803af
5 changed files with 59 additions and 42 deletions
+5
View File
@@ -154,6 +154,10 @@ func ListReleases(ctx *context.APIContext) {
// in: query
// description: filter (exclude / include) pre-releases
// type: boolean
// - name: tag_filter
// in: query
// description: 'filter releases by tag. supports "*" as a wildcard (for example: v1*, *beta, *rc*).'
// type: string
// - name: page
// in: query
// description: page number of results to return (1-based)
@@ -178,6 +182,7 @@ func ListReleases(ctx *context.APIContext) {
IsDraft: ctx.FormOptionalBool("draft"),
IsPreRelease: ctx.FormOptionalBool("pre-release"),
RepoID: ctx.Repo.Repository.ID,
TagFilter: ctx.FormString("tag_filter"),
}
releases, err := db.Find[repo_model.Release](ctx, opts)