0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-20 12:38:28 +02:00

Update modules/actions/workflows.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Sumit 2025-04-29 23:51:49 +05:30 committed by GitHub
parent 666411692b
commit 56314f605a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -370,17 +370,12 @@ func matchIssuesEvent(issuePayload *api.IssuePayload, evt *jobparser.Event) bool
actions := []string{} actions := []string{}
switch issuePayload.Action { switch issuePayload.Action {
case api.HookIssueLabelUpdated: case api.HookIssueLabelUpdated:
// Check if both labels were added and removed to determine events to fire if len(issuePayload.Issue.Labels) > 0 {
if len(issuePayload.Issue.Labels) > 0 && len(issuePayload.RemovedLabels) > 0 {
// Both labeled and unlabeled events should be triggered
actions = append(actions, "labeled", "unlabeled")
} else if len(issuePayload.RemovedLabels) > 0 {
// Only labels were removed
actions = append(actions, "unlabeled")
} else {
// Only labels were added
actions = append(actions, "labeled") actions = append(actions, "labeled")
} }
if len(issuePayload.RemovedLabels) > 0 {
actions = append(actions, "unlabeled")
}
case api.HookIssueLabelCleared: case api.HookIssueLabelCleared:
actions = append(actions, "unlabeled") actions = append(actions, "unlabeled")
default: default: