Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new fields to WorkflowRun #2237

Closed
tohjustin opened this issue Dec 23, 2021 · 0 comments · Fixed by #2238
Closed

Add new fields to WorkflowRun #2237

tohjustin opened this issue Dec 23, 2021 · 0 comments · Fixed by #2238

Comments

@tohjustin
Copy link
Contributor

tohjustin commented Dec 23, 2021

The following new fields can be found in the WorkflowRun object when querying the /repos/{owner}/{repo}/actions/runs & /repos/{owner}/{repo}/actions/runs/{run_id} endpoints:

  • previous_attempt_url
  • run_attempt
  • run_started_at

They aren't shown in the example responses found in their API docs yet but you can see them from the API requests via cURL (from workflow runs back in 2020):

$ curl "https://api.github.com/repos/actions/runner/actions/runs/111773609"
{
  "id": 111773609,
  "name": "Code Scanning - Action",
  "node_id": "MDExOldvcmtmbG93UnVuMTExNzczNjA5",
  "head_branch": "master",
  "head_sha": "11435857e4cd9795fa5ee68c20b674e5f96052ab",
  "run_number": 34,
  "event": "push",
  "status": "completed",
  "conclusion": "success",
  "workflow_id": 1221321,
  "check_suite_id": 705507172,
  "check_suite_node_id": "MDEwOkNoZWNrU3VpdGU3MDU1MDcxNzI=",
  "url": "https://api.github.com/repos/actions/runner/actions/runs/111773609",
  "html_url": "https://github.com/actions/runner/actions/runs/111773609",
  "pull_requests": [
    {
      "url": "https://api.github.com/repos/ToSa27/runner/pulls/1",
      "id": 402596127,
      "number": 1,
      "head": {
        "ref": "master",
        "sha": "dcda342eccd152fe69521d59de016ef09b70400c",
        "repo": {
          "id": 184286875,
          "url": "https://api.github.com/repos/actions/runner",
          "name": "runner"
        }
      },
      "base": {
        "ref": "master",
        "sha": "94930014a876a51d7d50ea7afcfce97e09203b9b",
        "repo": {
          "id": 246471129,
          "url": "https://api.github.com/repos/ToSa27/runner",
          "name": "runner"
        }
      }
    }
  ],
  "created_at": "2020-05-21T19:49:21Z",
  "updated_at": "2020-05-21T19:59:31Z",
  "run_attempt": 1,
  "run_started_at": "2020-05-21T19:49:21Z",
  "jobs_url": "https://api.github.com/repos/actions/runner/actions/runs/111773609/jobs",
  "logs_url": "https://api.github.com/repos/actions/runner/actions/runs/111773609/logs",
  "check_suite_url": "https://api.github.com/repos/actions/runner/check-suites/705507172",
  "artifacts_url": "https://api.github.com/repos/actions/runner/actions/runs/111773609/artifacts",
  "cancel_url": "https://api.github.com/repos/actions/runner/actions/runs/111773609/cancel",
  "rerun_url": "https://api.github.com/repos/actions/runner/actions/runs/111773609/rerun",
  "previous_attempt_url": null,
  "workflow_url": "https://api.github.com/repos/actions/runner/actions/workflows/1221321",
  "head_commit": { ... },
  "repository": { ... },
  "head_repository": { ... }
}

And also the OpenAPI spec for api.github.com:

{
  "openapi": "3.0.3",
  "components": {
    "schemas": {
      "workflow-run": {
        "title": "Workflow Run",
        "description": "An invocation of a workflow",
        "type": "object",
        "properties": {
          "run_attempt": {
            "type": "integer",
            "description": "Attempt number of the run, 1 for first attempt and higher if the workflow was re-run.",
            "example": 1
          },
          "run_started_at": {
            "type": "string",
            "format": "date-time",
            "description": "The start time of the latest run. Resets on re-run."
          },
          "previous_attempt_url": {
            "nullable": true,
            "description": "The URL to the previous attempted run of this workflow, if one exists.",
            "type": "string",
            "example": "https://api.github.com/repos/github/hello-world/actions/runs/5/attempts/3"
          },
          ...
        },
        "required": [
          "id",
          "node_id",
          "head_branch",
          "run_number",
          "event",
          "status",
          "conclusion",
          "head_sha",
          "workflow_id",
          "url",
          "html_url",
          "created_at",
          "updated_at",
          "head_commit",
          "head_repository",
          "repository",
          "jobs_url",
          "logs_url",
          "check_suite_url",
          "cancel_url",
          "rerun_url",
          "artifacts_url",
          "workflow_url",
          "pull_requests"
        ]
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant