Skip to content

Commit 4b5e013

Browse files
pjeMartin Lopeshubwriter
authored
Use in_progress workflow_job example, not queued (#22880)
* Use in_progress workflow_job example, not queued ### tl;dr This changes the example `workflow_job` payload to be an `in_progress` event instead of `queued` event. ### why In #22174, I added some keys to the example workflow_job json. This was correct, but by adding non-null _values_, **I introduced a subtle bug**. It's a bug because a `queued` workflow is—by definition—_not_ yet assigned to a runner. So all the `runner_*` attributes will be `null` in the real world. After the workflow becomes `in_progress`, all the values are guaranteed to exist. So let's change the example to be an `in_progress` event, since it's a better example for documentation. * Explain more about the runner_* attributes in "workflow_job_properties.md" * Consistentize naming Co-authored-by: Martin Lopes <martin389@github.com> Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 04bd69e commit 4b5e013

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

data/reusables/webhooks/workflow_job_properties.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ Key | Type | Description
22
----|------|-------------
33
`action`|`string` | The action performed. Can be one of: <ul><li> `queued` - A new job was created.</li><li> `in_progress` - The job has started processing on the runner.</li><li> `completed` - The `status` of the job is `completed`.</li></ul>
44
`workflow_job`|`object`| The workflow job. Many `workflow_job` keys, such as `head_sha`, `conclusion`, and `started_at` are the same as those in a [`check_run`](#check_run) object.
5+
`workflow_job[status]`|`string`| The current status of the job. Can be `queued`, `in_progress`, or `completed`.
6+
`workflow_job[labels]`|`array`| Custom labels for the job. Specified by the [`"runs-on"` attribute](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on) in the workflow YAML.
7+
`workflow_job[runner_id]`|`integer`| The ID of the runner that is running this job. This will be `null` as long as `workflow_job[status]` is `queued`.
8+
`workflow_job[runner_name]`|`string`| The name of the runner that is running this job. This will be `null` as long as `workflow_job[status]` is `queued`.
9+
`workflow_job[runner_group_id]`|`integer`| The ID of the runner group that is running this job. This will be `null` as long as `workflow_job[status]` is `queued`.
10+
`workflow_job[runner_group_name]`|`string`| The name of the runner group that is running this job. This will be `null` as long as `workflow_job[status]` is `queued`.

lib/webhooks/static/dotcom/workflow_job.payload.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"action": "queued",
2+
"action": "in_progress",
33
"workflow_job": {
44
"id": 2832853555,
55
"run_id": 940463255,
@@ -8,13 +8,20 @@
88
"head_sha": "e3103f8eb03e1ad7f2331c5446b23c070fc54055",
99
"url": "https://api.github.com/repos/octo-org/example-workflow/actions/jobs/2832853555",
1010
"html_url": "https://github.com/octo-org/example-workflow/runs/2832853555",
11-
"status": "queued",
11+
"status": "in_progress",
1212
"conclusion": null,
1313
"started_at": "2021-06-15T19:22:27Z",
1414
"completed_at": null,
1515
"name": "Test workflow",
1616
"steps": [
17-
17+
{
18+
"name": "Set up job",
19+
"status": "in_progress",
20+
"conclusion": null,
21+
"number": 1,
22+
"started_at": "2021-06-15T19:22:27.000Z",
23+
"completed_at": null
24+
}
1825
],
1926
"check_run_url": "https://api.github.com/repos/octo-org/example-workflow/check-runs/2832853555",
2027
"labels": [

0 commit comments

Comments
 (0)