Skip to content

Commit d8505a9

Browse files
authored
Fix create commit status (#30225)
Partially backport #30223 This PR uses the service layer `CreateCommitstatus` method instead of the git model method.
1 parent 22a18e6 commit d8505a9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

services/actions/commit_status.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"code.gitea.io/gitea/modules/log"
1717
api "code.gitea.io/gitea/modules/structs"
1818
webhook_module "code.gitea.io/gitea/modules/webhook"
19+
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"
1920

2021
"github.com/nektos/act/pkg/jobparser"
2122
)
@@ -122,19 +123,16 @@ func createCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
122123
if err != nil {
123124
return fmt.Errorf("HashTypeInterfaceFromHashString: %w", err)
124125
}
125-
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
126-
Repo: repo,
127-
SHA: commitID,
128-
Creator: creator,
129-
CommitStatus: &git_model.CommitStatus{
126+
if err := commitstatus_service.CreateCommitStatus(ctx, repo, creator,
127+
commitID.String(),
128+
&git_model.CommitStatus{
130129
SHA: sha,
131130
TargetURL: fmt.Sprintf("%s/jobs/%d", run.Link(), index),
132131
Description: description,
133132
Context: ctxname,
134133
CreatorID: creator.ID,
135134
State: state,
136-
},
137-
}); err != nil {
135+
}); err != nil {
138136
return fmt.Errorf("NewCommitStatus: %w", err)
139137
}
140138

0 commit comments

Comments
 (0)