mirror of
https://github.com/go-gitea/gitea.git
synced 2025-01-02 01:17:43 +03:00
Merge 03f06a43a4
into d45456b1b5
This commit is contained in:
commit
b46be6b7e3
@ -377,6 +377,23 @@ func GetLatestRun(ctx context.Context, repoID int64) (*ActionRun, error) {
|
||||
return run, nil
|
||||
}
|
||||
|
||||
func GetRunsBeforeDate(ctx context.Context, repoID int64, beforeDate time.Time) ([]*ActionRun, error) {
|
||||
var runs []*ActionRun
|
||||
err := db.GetEngine(ctx).
|
||||
Where("repo_id = ?", repoID).
|
||||
And("created < ?", beforeDate).
|
||||
Find(&runs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return runs, nil
|
||||
}
|
||||
|
||||
func GetObsoleteRuns(ctx context.Context, repoID int64, days int) ([]*ActionRun, error) {
|
||||
thresholdDate := time.Now().AddDate(0, 0, -days)
|
||||
return GetRunsBeforeDate(ctx, repoID, thresholdDate)
|
||||
}
|
||||
|
||||
func GetWorkflowLatestRun(ctx context.Context, repoID int64, workflowFile, branch, event string) (*ActionRun, error) {
|
||||
var run ActionRun
|
||||
q := db.GetEngine(ctx).Where("repo_id=?", repoID).
|
||||
|
Loading…
Reference in New Issue
Block a user