@@ -13,11 +13,12 @@ import (
1313 repo_model "code.gitea.io/gitea/models/repo"
1414 user_model "code.gitea.io/gitea/models/user"
1515 "code.gitea.io/gitea/modules/cache"
16- "code.gitea.io/gitea/modules/git"
1716 "code.gitea.io/gitea/modules/gitrepo"
1817 "code.gitea.io/gitea/modules/log"
18+ "code.gitea.io/gitea/modules/repository"
1919 api "code.gitea.io/gitea/modules/structs"
2020 "code.gitea.io/gitea/services/automerge"
21+ "code.gitea.io/gitea/services/notify"
2122)
2223
2324func getCacheKey (repoID int64 , brancheName string ) string {
@@ -48,16 +49,10 @@ func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creato
4849 }
4950 defer closer .Close ()
5051
51- objectFormat := git .ObjectFormatFromName (repo .ObjectFormatName )
52-
5352 commit , err := gitRepo .GetCommit (sha )
5453 if err != nil {
5554 return fmt .Errorf ("GetCommit[%s]: %w" , sha , err )
5655 }
57- if len (sha ) != objectFormat .FullLength () {
58- // use complete commit sha
59- sha = commit .ID .String ()
60- }
6156
6257 if err := git_model .NewCommitStatus (ctx , git_model.NewCommitStatusOptions {
6358 Repo : repo ,
@@ -68,6 +63,10 @@ func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creato
6863 return fmt .Errorf ("NewCommitStatus[repo_id: %d, user_id: %d, sha: %s]: %w" , repo .ID , creator .ID , sha , err )
6964 }
7065
66+ pushCommit := repository .CommitToPushCommit (commit )
67+
68+ notify .CreateCommitStatus (ctx , repo , pushCommit , creator , status )
69+
7170 defaultBranchCommit , err := gitRepo .GetBranchCommit (repo .DefaultBranch )
7271 if err != nil {
7372 return fmt .Errorf ("GetBranchCommit[%s]: %w" , repo .DefaultBranch , err )
0 commit comments