mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-01-16 23:12:07 +00:00
chore(refactor): detectWorkflow process pull_request_target first
Collecting pull_request_target workflows before the others changes nothing. They will be first in the list but there is no guarantee or need for ordering. This is in preparation of a future commit that needs to know the base commit before detecting workflows that are not pull_request_target.
This commit is contained in:
parent
e6522c1ecc
commit
6a99709a1c
1 changed files with 12 additions and 11 deletions
|
|
@ -242,17 +242,6 @@ func detectWorkflows(ctx context.Context, input *notifyInput, gitRepo *git.Repos
|
|||
len(schedules),
|
||||
)
|
||||
|
||||
for _, wf := range workflows {
|
||||
if actionsConfig.IsWorkflowDisabled(wf.EntryName) {
|
||||
log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName)
|
||||
continue
|
||||
}
|
||||
|
||||
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
|
||||
detectedWorkflows = append(detectedWorkflows, wf)
|
||||
}
|
||||
}
|
||||
|
||||
if input.PullRequest != nil && !actions_module.IsDefaultBranchWorkflow(input.Event) {
|
||||
// detect pull_request_target workflows
|
||||
baseRef := git.BranchPrefix + input.PullRequest.BaseBranch
|
||||
|
|
@ -280,6 +269,18 @@ func detectWorkflows(ctx context.Context, input *notifyInput, gitRepo *git.Repos
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, wf := range workflows {
|
||||
if actionsConfig.IsWorkflowDisabled(wf.EntryName) {
|
||||
log.Trace("repo %s has disable workflows %s", input.Repo.RepoPath(), wf.EntryName)
|
||||
continue
|
||||
}
|
||||
|
||||
if wf.TriggerEvent.Name != actions_module.GithubEventPullRequestTarget {
|
||||
detectedWorkflows = append(detectedWorkflows, wf)
|
||||
}
|
||||
}
|
||||
|
||||
return detectedWorkflows, schedules, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue