Support using label names when changing issue labels (#30943)

Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>

(cherry picked from commit b3beaed147466739de0c24fd80206b5af8b71617)

Conflicts:
	- modules/structs/issue_label.go
	  Resolved by applying the Gitea change by hand.
	- tests/integration/api_issue_label_test.go
	  Resolved by copying the new tests.
This commit is contained in:
Zettat123 2024-05-13 12:28:53 +08:00 committed by Gergely Nagy
parent 4fb3f2a1fe
commit 8e1de85980
No known key found for this signature in database
4 changed files with 86 additions and 12 deletions

View file

@ -57,8 +57,9 @@ type DeleteLabelsOption struct {
// IssueLabelsOption a collection of labels
type IssueLabelsOption struct {
// list of label IDs
Labels []int64 `json:"labels"`
// Labels can be a list of integers representing label IDs
// or a list of strings representing label names
Labels []any `json:"labels"`
// swagger:strfmt date-time
Updated *time.Time `json:"updated_at"`
}