diff --git a/services/actions/notifier.go b/services/actions/notifier.go index a639d53262..57990a4e99 100644 --- a/services/actions/notifier.go +++ b/services/actions/notifier.go @@ -16,6 +16,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/gitrepo" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" @@ -774,6 +775,15 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep status, _ := convert.ToActionsStatus(run.Status) + gitRepo, err := gitrepo.OpenRepository(context.Background(), repo) + if err != nil { + log.Error("OpenRepository: %v", err) + return + } + defer gitRepo.Close() + + convertedWorkflow, err := convert.GetActionWorkflow(ctx, gitRepo, repo, run.WorkflowID) + convertedRun, err := convert.ToActionWorkflowRun(repo, run) if err != nil { log.Error("ToActionWorkflowRun: %v", err) @@ -782,7 +792,7 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep newNotifyInput(repo, sender, webhook_module.HookEventWorkflowRun).WithPayload(&api.WorkflowRunPayload{ Action: status, - Workflow: nil, + Workflow: convertedWorkflow, WorkflowRun: convertedRun, Organization: org, Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}), diff --git a/services/webhook/notifier.go b/services/webhook/notifier.go index 41d9b07255..9878dd8c62 100644 --- a/services/webhook/notifier.go +++ b/services/webhook/notifier.go @@ -16,6 +16,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/gitrepo" "code.gitea.io/gitea/modules/httplib" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/repository" @@ -986,8 +987,14 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_ status, _ := convert.ToActionsStatus(run.Status) - // TODO get gitrepo instance - // convertedWorkflow, err := convert.GetActionWorkflow(ctx, nil, nil, run.WorkflowID) + gitRepo, err := gitrepo.OpenRepository(ctx, repo) + if err != nil { + log.Error("OpenRepository: %v", err) + return + } + defer gitRepo.Close() + + convertedWorkflow, err := convert.GetActionWorkflow(ctx, gitRepo, repo, run.WorkflowID) convertedRun, err := convert.ToActionWorkflowRun(repo, run) if err != nil { @@ -997,7 +1004,7 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_ if err := PrepareWebhooks(ctx, source, webhook_module.HookEventWorkflowRun, &api.WorkflowRunPayload{ Action: status, - Workflow: nil, + Workflow: convertedWorkflow, WorkflowRun: convertedRun, Organization: org, Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),