This commit is contained in:
Christopher Homberger 2025-02-23 17:06:50 +01:00
parent 1a16ea3097
commit 547d2202d9
2 changed files with 9 additions and 6 deletions

View File

@ -6,7 +6,6 @@ package notify
import (
"context"
"code.gitea.io/gitea/models/actions"
actions_model "code.gitea.io/gitea/models/actions"
git_model "code.gitea.io/gitea/models/git"
issues_model "code.gitea.io/gitea/models/issues"
@ -80,5 +79,5 @@ type Notifier interface {
CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, commit *repository.PushCommit, sender *user_model.User, status *git_model.CommitStatus)
CreateWorkflowJob(ctx context.Context, repo *repo_model.Repository, sender *user_model.User, job *actions.ActionRunJob, task *actions_model.ActionTask)
CreateWorkflowJob(ctx context.Context, repo *repo_model.Repository, sender *user_model.User, job *actions_model.ActionRunJob, task *actions_model.ActionTask)
}

View File

@ -954,14 +954,18 @@ func (*webhookNotifier) CreateWorkflowJob(ctx context.Context, repo *repo_model.
org = convert.ToOrganization(ctx, organization.OrgFromUser(repo.Owner))
}
job.LoadAttributes(ctx)
err := job.LoadAttributes(ctx)
if err != nil {
log.Error("Error loading job attributes: %v", err)
return
}
action, conclusion := toActionStatus(job.Status)
var runnerId int64
var runnerID int64
var steps []*api.ActionWorkflowStep
if task != nil {
runnerId = task.RunnerID
runnerID = task.RunnerID
for i, step := range task.Steps {
_, stepConclusion := toActionStatus(job.Status)
steps = append(steps, &api.ActionWorkflowStep{
@ -986,7 +990,7 @@ func (*webhookNotifier) CreateWorkflowJob(ctx context.Context, repo *repo_model.
HeadSha: job.Run.CommitSHA,
HeadBranch: git.RefName(job.Run.Ref).BranchName(),
Conclusion: conclusion,
RunnerID: runnerId,
RunnerID: runnerID,
Steps: steps,
CreatedAt: job.Created.AsTime().UTC(),
StartedAt: job.Started.AsTime().UTC(),