mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-26 23:46:22 +01:00
cleanup and fix webhook type bug
This commit is contained in:
parent
a178e4be7a
commit
295bf45d5c
@ -8,7 +8,9 @@ import (
|
|||||||
|
|
||||||
actions_model "code.gitea.io/gitea/models/actions"
|
actions_model "code.gitea.io/gitea/models/actions"
|
||||||
issues_model "code.gitea.io/gitea/models/issues"
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
|
"code.gitea.io/gitea/models/organization"
|
||||||
packages_model "code.gitea.io/gitea/models/packages"
|
packages_model "code.gitea.io/gitea/models/packages"
|
||||||
|
"code.gitea.io/gitea/models/perm"
|
||||||
perm_model "code.gitea.io/gitea/models/perm"
|
perm_model "code.gitea.io/gitea/models/perm"
|
||||||
access_model "code.gitea.io/gitea/models/perm/access"
|
access_model "code.gitea.io/gitea/models/perm/access"
|
||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
@ -765,11 +767,26 @@ func (n *actionsNotifier) MigrateRepository(ctx context.Context, doer, u *user_m
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_model.Repository, sender *user_model.User, run *actions_model.ActionRun) {
|
func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_model.Repository, sender *user_model.User, run *actions_model.ActionRun) {
|
||||||
|
var org *api.Organization
|
||||||
|
if repo.Owner.IsOrganization() {
|
||||||
|
org = convert.ToOrganization(ctx, organization.OrgFromUser(repo.Owner))
|
||||||
|
}
|
||||||
|
|
||||||
|
status, _ := convert.ToActionsStatus(run.Status)
|
||||||
|
|
||||||
|
convertedRun, err := convert.ToActionWorkflowRun(repo, run)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("ToActionWorkflowRun: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
run.Status.IsBlocked()
|
run.Status.IsBlocked()
|
||||||
newNotifyInput(repo, sender, webhook_module.HookEventWorkflowRun).WithPayload(&api.WorkflowRunPayload{
|
newNotifyInput(repo, sender, webhook_module.HookEventWorkflowRun).WithPayload(&api.WorkflowRunPayload{
|
||||||
Action: "queued",
|
Action: status,
|
||||||
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm_model.AccessModeOwner}),
|
Workflow: nil,
|
||||||
Organization: nil,
|
WorkflowRun: convertedRun,
|
||||||
|
Organization: org,
|
||||||
|
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
|
||||||
Sender: convert.ToUser(ctx, sender, nil),
|
Sender: convert.ToUser(ctx, sender, nil),
|
||||||
}).Notify(ctx)
|
}).Notify(ctx)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -992,7 +992,7 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := PrepareWebhooks(ctx, source, webhook_module.HookEventWorkflowJob, &api.WorkflowRunPayload{
|
if err := PrepareWebhooks(ctx, source, webhook_module.HookEventWorkflowRun, &api.WorkflowRunPayload{
|
||||||
Action: status,
|
Action: status,
|
||||||
Workflow: nil,
|
Workflow: nil,
|
||||||
WorkflowRun: convertedRun,
|
WorkflowRun: convertedRun,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user