|
|
@ -106,8 +106,8 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType |
|
|
|
webhook_module.HookEventRepository, |
|
|
|
webhook_module.HookEventRepository, |
|
|
|
webhook_module.HookEventRelease, |
|
|
|
webhook_module.HookEventRelease, |
|
|
|
webhook_module.HookEventPackage: |
|
|
|
webhook_module.HookEventPackage: |
|
|
|
if len(evt.Acts) != 0 { |
|
|
|
if len(evt.Acts()) != 0 { |
|
|
|
log.Warn("Ignore unsupported %s event arguments %q", triggedEvent, evt.Acts) |
|
|
|
log.Warn("Ignore unsupported %s event arguments %v", triggedEvent, evt.Acts()) |
|
|
|
} |
|
|
|
} |
|
|
|
// no special filter parameters for these events, just return true if name matched
|
|
|
|
// no special filter parameters for these events, just return true if name matched
|
|
|
|
return true |
|
|
|
return true |
|
|
@ -132,7 +132,7 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType |
|
|
|
|
|
|
|
|
|
|
|
func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool { |
|
|
|
func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool { |
|
|
|
// with no special filter parameters
|
|
|
|
// with no special filter parameters
|
|
|
|
if len(evt.Acts) == 0 { |
|
|
|
if len(evt.Acts()) == 0 { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -141,7 +141,7 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa |
|
|
|
hasTagFilter := false |
|
|
|
hasTagFilter := false |
|
|
|
refName := git.RefName(pushPayload.Ref) |
|
|
|
refName := git.RefName(pushPayload.Ref) |
|
|
|
// all acts conditions should be satisfied
|
|
|
|
// all acts conditions should be satisfied
|
|
|
|
for cond, vals := range evt.Acts { |
|
|
|
for cond, vals := range evt.Acts() { |
|
|
|
switch cond { |
|
|
|
switch cond { |
|
|
|
case "branches": |
|
|
|
case "branches": |
|
|
|
hasBranchFilter = true |
|
|
|
hasBranchFilter = true |
|
|
@ -225,18 +225,18 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa |
|
|
|
if hasBranchFilter && hasTagFilter { |
|
|
|
if hasBranchFilter && hasTagFilter { |
|
|
|
matchTimes++ |
|
|
|
matchTimes++ |
|
|
|
} |
|
|
|
} |
|
|
|
return matchTimes == len(evt.Acts) |
|
|
|
return matchTimes == len(evt.Acts()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool { |
|
|
|
func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool { |
|
|
|
// with no special filter parameters
|
|
|
|
// with no special filter parameters
|
|
|
|
if len(evt.Acts) == 0 { |
|
|
|
if len(evt.Acts()) == 0 { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
matchTimes := 0 |
|
|
|
matchTimes := 0 |
|
|
|
// all acts conditions should be satisfied
|
|
|
|
// all acts conditions should be satisfied
|
|
|
|
for cond, vals := range evt.Acts { |
|
|
|
for cond, vals := range evt.Acts() { |
|
|
|
switch cond { |
|
|
|
switch cond { |
|
|
|
case "types": |
|
|
|
case "types": |
|
|
|
for _, val := range vals { |
|
|
|
for _, val := range vals { |
|
|
@ -249,19 +249,19 @@ func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *j |
|
|
|
log.Warn("issue event unsupported condition %q", cond) |
|
|
|
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 { |
|
|
|
func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload, evt *jobparser.Event) bool { |
|
|
|
// with no special filter parameters
|
|
|
|
// 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
|
|
|
|
// defaultly, only pull request opened and synchronized will trigger workflow
|
|
|
|
return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened |
|
|
|
return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
matchTimes := 0 |
|
|
|
matchTimes := 0 |
|
|
|
// all acts conditions should be satisfied
|
|
|
|
// all acts conditions should be satisfied
|
|
|
|
for cond, vals := range evt.Acts { |
|
|
|
for cond, vals := range evt.Acts() { |
|
|
|
switch cond { |
|
|
|
switch cond { |
|
|
|
case "types": |
|
|
|
case "types": |
|
|
|
action := prPayload.Action |
|
|
|
action := prPayload.Action |
|
|
@ -323,18 +323,18 @@ func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload |
|
|
|
log.Warn("pull request event unsupported condition %q", cond) |
|
|
|
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 { |
|
|
|
func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCommentPayload, evt *jobparser.Event) bool { |
|
|
|
// with no special filter parameters
|
|
|
|
// with no special filter parameters
|
|
|
|
if len(evt.Acts) == 0 { |
|
|
|
if len(evt.Acts()) == 0 { |
|
|
|
return true |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
matchTimes := 0 |
|
|
|
matchTimes := 0 |
|
|
|
// all acts conditions should be satisfied
|
|
|
|
// all acts conditions should be satisfied
|
|
|
|
for cond, vals := range evt.Acts { |
|
|
|
for cond, vals := range evt.Acts() { |
|
|
|
switch cond { |
|
|
|
switch cond { |
|
|
|
case "types": |
|
|
|
case "types": |
|
|
|
for _, val := range vals { |
|
|
|
for _, val := range vals { |
|
|
@ -347,5 +347,5 @@ func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCo |
|
|
|
log.Warn("issue comment unsupported condition %q", cond) |
|
|
|
log.Warn("issue comment unsupported condition %q", cond) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return matchTimes == len(evt.Acts) |
|
|
|
return matchTimes == len(evt.Acts()) |
|
|
|
} |
|
|
|
} |
|
|
|