mirror of
https://github.com/go-gitea/gitea.git
synced 2026-06-14 03:29:55 +00:00
feat(api): Add GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs (#37196)
- Add GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs
endpoint, matching the
https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2026-03-10#list-workflow-runs-for-a-workflow
---------
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
@@ -23,7 +23,10 @@ func (repo *Repository) GetRefCommitID(name string) (string, error) {
|
||||
}
|
||||
refName := plumbing.ReferenceName(name)
|
||||
if err := refName.Validate(); err != nil {
|
||||
return "", err
|
||||
// Match the nogogit behavior: an unresolvable/invalid ref name
|
||||
// is reported as not-existing rather than a generic validation error,
|
||||
// so callers can rely on IsErrNotExist regardless of build tag.
|
||||
return "", ErrNotExist{ID: name}
|
||||
}
|
||||
ref, err := repo.gogitRepo.Reference(refName, true)
|
||||
if err != nil {
|
||||
|
||||
@@ -117,23 +117,48 @@ type ActionWorkflowRun struct {
|
||||
// RunAttempt is 1-based for runs created after ActionRunAttempt was introduced.
|
||||
// A value of 0 is a legacy-only sentinel for runs created before attempts existed
|
||||
// and indicates no corresponding /attempts/{n} resource is available.
|
||||
RunAttempt int64 `json:"run_attempt"`
|
||||
RunNumber int64 `json:"run_number"`
|
||||
RepositoryID int64 `json:"repository_id,omitempty"`
|
||||
HeadSha string `json:"head_sha"`
|
||||
HeadBranch string `json:"head_branch,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Actor *User `json:"actor,omitempty"`
|
||||
TriggerActor *User `json:"trigger_actor,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
HeadRepository *Repository `json:"head_repository,omitempty"`
|
||||
Conclusion string `json:"conclusion,omitempty"`
|
||||
RunAttempt int64 `json:"run_attempt"`
|
||||
RunNumber int64 `json:"run_number"`
|
||||
RepositoryID int64 `json:"repository_id,omitempty"`
|
||||
HeadSha string `json:"head_sha"`
|
||||
HeadBranch string `json:"head_branch,omitempty"`
|
||||
Status string `json:"status"`
|
||||
Actor *User `json:"actor,omitempty"`
|
||||
TriggerActor *User `json:"trigger_actor,omitempty"`
|
||||
Repository *Repository `json:"repository,omitempty"`
|
||||
HeadRepository *Repository `json:"head_repository,omitempty"`
|
||||
Conclusion string `json:"conclusion,omitempty"`
|
||||
PullRequests []*PullRequestMinimal `json:"pull_requests"`
|
||||
// swagger:strfmt date-time
|
||||
StartedAt time.Time `json:"started_at"`
|
||||
// swagger:strfmt date-time
|
||||
CompletedAt time.Time `json:"completed_at"`
|
||||
}
|
||||
|
||||
// PullRequestMinimal is the minimal information about a pull request, as
|
||||
// returned in the `pull_requests` field of a workflow run.
|
||||
type PullRequestMinimal struct {
|
||||
ID int64 `json:"id"`
|
||||
Number int64 `json:"number"`
|
||||
URL string `json:"url"`
|
||||
Head PullRequestMinimalHead `json:"head"`
|
||||
Base PullRequestMinimalHead `json:"base"`
|
||||
}
|
||||
|
||||
// PullRequestMinimalHead is a minimal description of one side of a pull request.
|
||||
type PullRequestMinimalHead struct {
|
||||
Ref string `json:"ref"`
|
||||
SHA string `json:"sha"`
|
||||
Repo PullRequestMinimalHeadRepo `json:"repo"`
|
||||
}
|
||||
|
||||
// PullRequestMinimalHeadRepo is a minimal description of the repository on one side of a pull request.
|
||||
type PullRequestMinimalHeadRepo struct {
|
||||
ID int64 `json:"id"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ActionWorkflowRunsResponse returns ActionWorkflowRuns
|
||||
type ActionWorkflowRunsResponse struct {
|
||||
Entries []*ActionWorkflowRun `json:"workflow_runs"`
|
||||
|
||||
Reference in New Issue
Block a user