diff options
author | Jason Song <i@wolfogre.com> | 2023-03-30 22:33:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 22:33:17 +0800 |
commit | 964a057a76793c32c81394505e2f480a4bf40d0d (patch) | |
tree | ff1cb54f30b43741c4a8c881ca0f2f0a7555e0c5 /modules/actions | |
parent | aa4d1d94f79e8edd9fa9ff2813fea12b085b2cae (diff) | |
download | gitea-964a057a76793c32c81394505e2f480a4bf40d0d.tar.gz gitea-964a057a76793c32c81394505e2f480a4bf40d0d.zip |
Fix checks for `needs` in Actions (#23789)
Fix:
- https://gitea.com/gitea/act_runner/issues/77
- https://gitea.com/gitea/act_runner/issues/81
Before:
<img width="1489" alt="image"
src="https://user-images.githubusercontent.com/9418365/228501567-f752cf87-a7ed-42c6-8f3d-ba741795c1fe.png">
Highlights:
- Upgrade act to make things doable, related to
- https://gitea.com/gitea/act/pulls/32
- https://gitea.com/gitea/act/pulls/33
- https://gitea.com/gitea/act/pulls/35
- Make `needs` works
- Sort jobs in the original order in the workflow files
Diffstat (limited to 'modules/actions')
-rw-r--r-- | modules/actions/workflows.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go index 1b8b6cc7ef..76c144bb2b 100644 --- a/modules/actions/workflows.go +++ b/modules/actions/workflows.go @@ -122,8 +122,8 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType webhook_module.HookEventRepository, webhook_module.HookEventRelease, webhook_module.HookEventPackage: - if len(evt.Acts) != 0 { - log.Warn("Ignore unsupported %s event arguments %q", triggedEvent, evt.Acts) + if len(evt.Acts()) != 0 { + log.Warn("Ignore unsupported %s event arguments %v", triggedEvent, evt.Acts()) } // no special filter parameters for these events, just return true if name matched return true @@ -148,7 +148,7 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool { // with no special filter parameters - if len(evt.Acts) == 0 { + if len(evt.Acts()) == 0 { return true } @@ -157,7 +157,7 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa hasTagFilter := false refName := git.RefName(pushPayload.Ref) // all acts conditions should be satisfied - for cond, vals := range evt.Acts { + for cond, vals := range evt.Acts() { switch cond { case "branches": hasBranchFilter = true @@ -241,18 +241,18 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa if hasBranchFilter && hasTagFilter { matchTimes++ } - return matchTimes == len(evt.Acts) + return matchTimes == len(evt.Acts()) } func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool { // with no special filter parameters - if len(evt.Acts) == 0 { + if len(evt.Acts()) == 0 { return true } matchTimes := 0 // all acts conditions should be satisfied - for cond, vals := range evt.Acts { + for cond, vals := range evt.Acts() { switch cond { case "types": for _, val := range vals { @@ -265,19 +265,19 @@ func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *j log.Warn("issue event unsupported condition %q", cond) } } - return matchTimes == len(evt.Acts) + return matchTimes == len(evt.Acts()) } func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload, evt *jobparser.Event) bool { // with no special filter parameters - if len(evt.Acts) == 0 { + if len(evt.Acts()) == 0 { // defaultly, only pull request opened and synchronized will trigger workflow return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened } matchTimes := 0 // all acts conditions should be satisfied - for cond, vals := range evt.Acts { + for cond, vals := range evt.Acts() { switch cond { case "types": action := prPayload.Action @@ -339,18 +339,18 @@ func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload log.Warn("pull request event unsupported condition %q", cond) } } - return matchTimes == len(evt.Acts) + return matchTimes == len(evt.Acts()) } func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCommentPayload, evt *jobparser.Event) bool { // with no special filter parameters - if len(evt.Acts) == 0 { + if len(evt.Acts()) == 0 { return true } matchTimes := 0 // all acts conditions should be satisfied - for cond, vals := range evt.Acts { + for cond, vals := range evt.Acts() { switch cond { case "types": for _, val := range vals { @@ -363,5 +363,5 @@ func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCo log.Warn("issue comment unsupported condition %q", cond) } } - return matchTimes == len(evt.Acts) + return matchTimes == len(evt.Acts()) } |