fix: rename the Attempts field to Attempt; expose in gh run view and gh run ls (#8905)

Co-authored-by: William Martin <williammartin@github.com>
This commit is contained in:
cawfeecake 2024-05-22 05:39:13 -07:00 committed by GitHub
parent 140edf7327
commit 105bafd2ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -72,6 +72,7 @@ var RunFields = []string{
"createdAt",
"updatedAt",
"startedAt",
"attempt",
"status",
"conclusion",
"event",
@ -97,7 +98,7 @@ type Run struct {
workflowName string // cache column
WorkflowID int64 `json:"workflow_id"`
Number int64 `json:"run_number"`
Attempts uint64 `json:"run_attempt"`
Attempt uint64 `json:"run_attempt"`
HeadBranch string `json:"head_branch"`
JobsURL string `json:"jobs_url"`
HeadCommit Commit `json:"head_commit"`

View file

@ -189,6 +189,15 @@ func TestRunExportData(t *testing.T) {
},
output: `{"jobs":[{"completedAt":"2022-07-20T11:21:16Z","conclusion":"success","databaseId":123456,"name":"macos","startedAt":"2022-07-20T11:20:13Z","status":"completed","steps":[{"conclusion":"success","name":"Checkout","number":1,"status":"completed"}],"url":"https://example.com/OWNER/REPO/actions/runs/123456"},{"completedAt":"2022-07-20T11:23:16Z","conclusion":"error","databaseId":234567,"name":"windows","startedAt":"2022-07-20T11:20:55Z","status":"completed","steps":[{"conclusion":"error","name":"Checkout","number":2,"status":"completed"}],"url":"https://example.com/OWNER/REPO/actions/runs/234567"}]}`,
},
{
name: "exports workflow run with attempt count",
fields: []string{"attempt"},
run: Run{
Attempt: 1,
Jobs: []Job{},
},
output: `{"attempt":1}`,
},
}
for _, tt := range tests {