mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-31 21:12:51 +09:00
feat: improve listing runs
This commit is contained in:
@ -51,9 +51,19 @@ func init() {
|
||||
}
|
||||
|
||||
func (run *ActionRun) HTMLURL() string {
|
||||
if run.Repo == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s/actions/runs/%d", run.Repo.HTMLURL(), run.Index)
|
||||
}
|
||||
|
||||
func (run *ActionRun) Link() string {
|
||||
if run.Repo == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s/actions/runs/%d", run.Repo.Link(), run.Index)
|
||||
}
|
||||
|
||||
// LoadAttributes load Repo TriggerUser if not loaded
|
||||
func (run *ActionRun) LoadAttributes(ctx context.Context) error {
|
||||
if run == nil {
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"crypto/subtle"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
@ -83,40 +82,18 @@ func (task *ActionTask) IsStopped() bool {
|
||||
return task.Stopped > 0
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetCommitSHA() string {
|
||||
if task.Job == nil {
|
||||
func (task *ActionTask) GetRunLink() string {
|
||||
if task.Job == nil || task.Job.Run == nil {
|
||||
return ""
|
||||
}
|
||||
if task.Job.Run == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return task.Job.Run.CommitSHA
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetCommitSHAShort() string {
|
||||
commitSHA := task.GetCommitSHA()
|
||||
if len(commitSHA) > 8 {
|
||||
return commitSHA[:8]
|
||||
}
|
||||
return commitSHA
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetBuildViewLink() string {
|
||||
if task.Job == nil || task.Job.Run == nil || task.Job.Run.Repo == nil {
|
||||
return ""
|
||||
}
|
||||
return task.Job.Run.Repo.Link() + "/actions/runs/" + strconv.FormatInt(task.ID, 10)
|
||||
return task.Job.Run.Link()
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetCommitLink() string {
|
||||
if task.Job == nil || task.Job.Run == nil || task.Job.Run.Repo == nil {
|
||||
return ""
|
||||
}
|
||||
if commitSHA := task.GetCommitSHA(); commitSHA != "" {
|
||||
return task.Job.Run.Repo.CommitLink(commitSHA)
|
||||
}
|
||||
return ""
|
||||
return task.Job.Run.Repo.CommitLink(task.CommitSHA)
|
||||
}
|
||||
|
||||
func (task *ActionTask) GetRepoName() string {
|
||||
|
Reference in New Issue
Block a user