aboutsummaryrefslogtreecommitdiffstats
path: root/models/actions/run.go
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-04-26 11:22:45 +0900
committerGitHub <noreply@github.com>2024-04-26 02:22:45 +0000
commit2a3906d75532ba8689338247d794f21dceb4d359 (patch)
tree900cf3500a02b798aef5e9e3efe47491dc8974af /models/actions/run.go
parent2a6418abb1e227f7d0401761a5f68d59a1cea9b2 (diff)
downloadgitea-2a3906d75532ba8689338247d794f21dceb4d359.tar.gz
gitea-2a3906d75532ba8689338247d794f21dceb4d359.zip
Improve job commit description (#30579)
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: 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 b75fa49f3c..d68710f46d 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)
@@ -156,6 +163,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",