mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-04 09:33:35 +02:00
webhook deliver the workflow field
This commit is contained in:
parent
658583a584
commit
da738eaa74
@ -16,6 +16,7 @@ import (
|
|||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
|
"code.gitea.io/gitea/modules/gitrepo"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/repository"
|
"code.gitea.io/gitea/modules/repository"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
@ -774,6 +775,15 @@ func (n *actionsNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *rep
|
|||||||
|
|
||||||
status, _ := convert.ToActionsStatus(run.Status)
|
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)
|
convertedRun, err := convert.ToActionWorkflowRun(repo, run)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("ToActionWorkflowRun: %v", err)
|
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{
|
newNotifyInput(repo, sender, webhook_module.HookEventWorkflowRun).WithPayload(&api.WorkflowRunPayload{
|
||||||
Action: status,
|
Action: status,
|
||||||
Workflow: nil,
|
Workflow: convertedWorkflow,
|
||||||
WorkflowRun: convertedRun,
|
WorkflowRun: convertedRun,
|
||||||
Organization: org,
|
Organization: org,
|
||||||
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
|
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
"code.gitea.io/gitea/modules/git"
|
"code.gitea.io/gitea/modules/git"
|
||||||
|
"code.gitea.io/gitea/modules/gitrepo"
|
||||||
"code.gitea.io/gitea/modules/httplib"
|
"code.gitea.io/gitea/modules/httplib"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/repository"
|
"code.gitea.io/gitea/modules/repository"
|
||||||
@ -986,8 +987,14 @@ func (*webhookNotifier) WorkflowRunStatusUpdate(ctx context.Context, repo *repo_
|
|||||||
|
|
||||||
status, _ := convert.ToActionsStatus(run.Status)
|
status, _ := convert.ToActionsStatus(run.Status)
|
||||||
|
|
||||||
// TODO get gitrepo instance
|
gitRepo, err := gitrepo.OpenRepository(ctx, repo)
|
||||||
// convertedWorkflow, err := convert.GetActionWorkflow(ctx, nil, nil, run.WorkflowID)
|
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)
|
convertedRun, err := convert.ToActionWorkflowRun(repo, run)
|
||||||
if err != nil {
|
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{
|
if err := PrepareWebhooks(ctx, source, webhook_module.HookEventWorkflowRun, &api.WorkflowRunPayload{
|
||||||
Action: status,
|
Action: status,
|
||||||
Workflow: nil,
|
Workflow: convertedWorkflow,
|
||||||
WorkflowRun: convertedRun,
|
WorkflowRun: convertedRun,
|
||||||
Organization: org,
|
Organization: org,
|
||||||
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
|
Repo: convert.ToRepo(ctx, repo, access_model.Permission{AccessMode: perm.AccessModeOwner}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user