aboutsummaryrefslogtreecommitdiffstats
path: root/models/actions/run.go
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-04-27 03:46:32 +0800
committerGitHub <noreply@github.com>2024-04-26 21:46:32 +0200
commit62a94ef7a49055c49823379fead6dd25622ccc89 (patch)
tree37115ba8bb63c5daf583883901d06d5230a7f139 /models/actions/run.go
parentbb6edb2eed7a003bce6fb87e5e24bd7a511e72f2 (diff)
downloadgitea-62a94ef7a49055c49823379fead6dd25622ccc89.tar.gz
gitea-62a94ef7a49055c49823379fead6dd25622ccc89.zip
Improve job commit description (#30579) (#30709)release/v1.22-legacy
Backport #30579 by @yp05327 Fix https://github.com/go-gitea/gitea/issues/30567 When job is a schedule: ![image](https://github.com/go-gitea/gitea/assets/18380374/b07e9d43-e8b7-4ee2-87b3-a7050c3a8ca5) When it is a normal one: ![image](https://github.com/go-gitea/gitea/assets/18380374/0d58dab9-74bb-421b-8952-0578cdf21a52) also add a 'space' behind `:` ![image](https://github.com/go-gitea/gitea/assets/18380374/4cebece0-bfe6-4ad9-b806-e5c49bb9be43) ![image](https://github.com/go-gitea/gitea/assets/18380374/02da7681-474b-4c0f-9dad-b6558f6cb484) Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/actions/run.go')
-rw-r--r--models/actions/run.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/models/actions/run.go b/models/actions/run.go
index fa9db0b554..25fecf35b7 100644
--- a/models/actions/run.go
+++ b/models/actions/run.go
@@ -74,6 +74,13 @@ func (run *ActionRun) Link() string {
return fmt.Sprintf("%s/actions/runs/%d", run.Repo.Link(), run.Index)
}
+func (run *ActionRun) WorkflowLink() string {
+ if run.Repo == nil {
+ return ""
+ }
+ return fmt.Sprintf("%s/actions/?workflow=%s", run.Repo.Link(), run.WorkflowID)
+}
+
// RefLink return the url of run's ref
func (run *ActionRun) RefLink() string {
refName := git.RefName(run.Ref)
@@ -146,6 +153,10 @@ func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, err
return nil, fmt.Errorf("event %s is not a pull request event", run.Event)
}
+func (run *ActionRun) IsSchedule() bool {
+ return run.ScheduleID > 0
+}
+
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
_, err := db.GetEngine(ctx).ID(repo.ID).
SetExpr("num_action_runs",