Skip to content

Commit

Permalink
Fix create commit status (#30225)
Browse files Browse the repository at this point in the history
Partially backport #30223 

This PR uses the service layer `CreateCommitstatus` method instead of
the git model method.
  • Loading branch information
lunny authored Apr 8, 2024
1 parent 22a18e6 commit d8505a9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions services/actions/commit_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs"
webhook_module "code.gitea.io/gitea/modules/webhook"
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"

"github.com/nektos/act/pkg/jobparser"
)
Expand Down Expand Up @@ -122,19 +123,16 @@ func createCommitStatus(ctx context.Context, job *actions_model.ActionRunJob) er
if err != nil {
return fmt.Errorf("HashTypeInterfaceFromHashString: %w", err)
}
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
Repo: repo,
SHA: commitID,
Creator: creator,
CommitStatus: &git_model.CommitStatus{
if err := commitstatus_service.CreateCommitStatus(ctx, repo, creator,
commitID.String(),
&git_model.CommitStatus{
SHA: sha,
TargetURL: fmt.Sprintf("%s/jobs/%d", run.Link(), index),
Description: description,
Context: ctxname,
CreatorID: creator.ID,
State: state,
},
}); err != nil {
}); err != nil {
return fmt.Errorf("NewCommitStatus: %w", err)
}

Expand Down

0 comments on commit d8505a9

Please sign in to comment.