diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-04-12 09:41:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 09:41:50 +0800 |
commit | fc34481d054a9324ea4654dc721e54e2f608ac17 (patch) | |
tree | 1d4800bebad9d3b52991d684a5f23d943dad7553 /services/actions | |
parent | 26ee66327fecf2f1755a47f9193bc6305132def1 (diff) | |
download | gitea-fc34481d054a9324ea4654dc721e54e2f608ac17.tar.gz gitea-fc34481d054a9324ea4654dc721e54e2f608ac17.zip |
Add commit status summary table to reduce query from commit status table (#30223)
This PR adds a new table named commit status summary to reduce queries
from the commit status table. After this change, commit status summary
table will be used for the final result, commit status table will be for
details.
---------
Co-authored-by: Jason Song <i@wolfogre.com>
Diffstat (limited to 'services/actions')
-rw-r--r-- | services/actions/commit_status.go | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/services/actions/commit_status.go b/services/actions/commit_status.go index 4236553927..eb031511f6 100644 --- a/services/actions/commit_status.go +++ b/services/actions/commit_status.go @@ -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" ) @@ -122,18 +123,13 @@ 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{ - SHA: sha, - TargetURL: fmt.Sprintf("%s/jobs/%d", run.Link(), index), - Description: description, - Context: ctxname, - CreatorID: creator.ID, - State: state, - }, + 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 { return fmt.Errorf("NewCommitStatus: %w", err) } |