diff --git a/modules/structs/action.go b/modules/structs/action.go index 1f015a08fb..82c530cdf9 100644 --- a/modules/structs/action.go +++ b/modules/structs/action.go @@ -12,6 +12,8 @@ import ( type ActionRunJob struct { // Identifier of this job. ID int64 `json:"id"` + // Identifier of the workflow run this job belongs to. + RunID int64 `json:"run_id"` // How many times the job has been attempted including the current attempt. Attempt int64 `json:"attempt"` // Opaque identifier that uniquely identifies a single attempt of a job. diff --git a/services/convert/action.go b/services/convert/action.go index dd21b9fb87..da40ac7916 100644 --- a/services/convert/action.go +++ b/services/convert/action.go @@ -71,6 +71,7 @@ func ToActionRunJob(job *actions_model.ActionRunJob) *api.ActionRunJob { return &api.ActionRunJob{ ID: job.ID, + RunID: job.RunID, Attempt: job.Attempt, Handle: job.Handle, RepoID: job.RepoID, diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 45159b7c71..e0afb22d54 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -22873,6 +22873,12 @@ "format": "int64", "x-go-name": "RepoID" }, + "run_id": { + "description": "Identifier of the workflow run this job belongs to.", + "type": "integer", + "format": "int64", + "x-go-name": "RunID" + }, "runs_on": { "description": "the action run job labels to run on", "type": "array", diff --git a/tests/integration/api_admin_actions_test.go b/tests/integration/api_admin_actions_test.go index 173e22ca91..67fc643761 100644 --- a/tests/integration/api_admin_actions_test.go +++ b/tests/integration/api_admin_actions_test.go @@ -46,6 +46,7 @@ func TestAPIAdminActionsGetJobs(t *testing.T) { expected := api.ActionRunJob{ ID: 393, + RunID: 891, Attempt: 1, Handle: "18e9cf40-c2f6-409f-b832-b945ea7dc79b", RepoID: 1, diff --git a/tests/integration/api_org_actions_test.go b/tests/integration/api_org_actions_test.go index 08de84cdf2..eb96435a45 100644 --- a/tests/integration/api_org_actions_test.go +++ b/tests/integration/api_org_actions_test.go @@ -37,6 +37,7 @@ func TestActionsAPISearchActionJobs_OrgRunner(t *testing.T) { job395 := api.ActionRunJob{ ID: 395, + RunID: 891, Attempt: 1, Handle: "40317a2f-2f00-4a82-8cc4-57347989a493", RepoID: 1, diff --git a/tests/integration/api_repo_actions_test.go b/tests/integration/api_repo_actions_test.go index ccf333191e..605d55c469 100644 --- a/tests/integration/api_repo_actions_test.go +++ b/tests/integration/api_repo_actions_test.go @@ -52,6 +52,7 @@ func TestActionsAPISearchActionJobs_RepoRunner(t *testing.T) { job393 := api.ActionRunJob{ ID: 393, + RunID: 891, Attempt: 1, Handle: "18e9cf40-c2f6-409f-b832-b945ea7dc79b", RepoID: 1, @@ -713,6 +714,7 @@ func TestActionsAPIListActionRunJobs(t *testing.T) { if expected.ID == 195 { assert.Equal(t, &api.ActionRunJob{ ID: 195, + RunID: 793, Attempt: 1, Handle: "", RepoID: 4, @@ -726,6 +728,7 @@ func TestActionsAPIListActionRunJobs(t *testing.T) { } else if expected.ID == 197 { assert.Equal(t, &api.ActionRunJob{ ID: 197, + RunID: 895, Attempt: 0, Handle: "", RepoID: 4, diff --git a/tests/integration/api_user_actions_test.go b/tests/integration/api_user_actions_test.go index b9a0b16ab4..91bd8c4be1 100644 --- a/tests/integration/api_user_actions_test.go +++ b/tests/integration/api_user_actions_test.go @@ -38,6 +38,7 @@ func TestActionsAPISearchActionJobs_UserRunner(t *testing.T) { job394 := api.ActionRunJob{ ID: 394, + RunID: 891, Attempt: 2, Handle: "a723d3e3-49a1-4e6b-947f-e987e60bfbd6", RepoID: 1,