mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 18:14:28 +00:00
Fix create commit status (#30225)
Partially backport #30223 This PR uses the service layer `CreateCommitstatus` method instead of the git model method.
This commit is contained in:
parent
22a18e6cbf
commit
d8505a949d
@ -16,6 +16,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
api "code.gitea.io/gitea/modules/structs"
|
api "code.gitea.io/gitea/modules/structs"
|
||||||
webhook_module "code.gitea.io/gitea/modules/webhook"
|
webhook_module "code.gitea.io/gitea/modules/webhook"
|
||||||
|
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"
|
||||||
|
|
||||||
"github.com/nektos/act/pkg/jobparser"
|
"github.com/nektos/act/pkg/jobparser"
|
||||||
)
|
)
|
||||||
@ -122,18 +123,15 @@ func createCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("HashTypeInterfaceFromHashString: %w", err)
|
return fmt.Errorf("HashTypeInterfaceFromHashString: %w", err)
|
||||||
}
|
}
|
||||||
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
|
if err := commitstatus_service.CreateCommitStatus(ctx, repo, creator,
|
||||||
Repo: repo,
|
commitID.String(),
|
||||||
SHA: commitID,
|
&git_model.CommitStatus{
|
||||||
Creator: creator,
|
|
||||||
CommitStatus: &git_model.CommitStatus{
|
|
||||||
SHA: sha,
|
SHA: sha,
|
||||||
TargetURL: fmt.Sprintf("%s/jobs/%d", run.Link(), index),
|
TargetURL: fmt.Sprintf("%s/jobs/%d", run.Link(), index),
|
||||||
Description: description,
|
Description: description,
|
||||||
Context: ctxname,
|
Context: ctxname,
|
||||||
CreatorID: creator.ID,
|
CreatorID: creator.ID,
|
||||||
State: state,
|
State: state,
|
||||||
},
|
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("NewCommitStatus: %w", err)
|
return fmt.Errorf("NewCommitStatus: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user