Workflow Jobs

A workflow job is a set of steps that execute on the same runner. For more information, see "Workflow syntax for GitHub Actions" in the GitHub Help documentation.

This API is available for authenticated users, OAuth Apps, and GitHub Apps. Access tokens require repo scope for private repos and public_repo scope for public repos. GitHub Apps must have the actions permission to use this API.

GitHub Actions is available with GitHub Free, GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub One. GitHub Actions is not available for repositories owned by accounts using legacy per-repository plans. For more information, see GitHub's products in the GitHub Help documentation.

List jobs for a workflow run

Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.

GET /repos/:owner/:repo/actions/runs/:run_id/jobs

Parameters

Name Type Description
filter string Filters jobs by their completed_at timestamp. Can be one of:
* latest: Returns jobs from the most recent execution of the workflow run.
* all: Returns all jobs for a workflow run, including from old executions of the workflow run.

Default: latest

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
{
  "total_count": 1,
  "jobs": [
    {
      "id": 399444496,
      "run_id": 29679449,
      "run_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/29679449",
      "node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==",
      "head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0",
      "url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/399444496",
      "html_url": "https://github.com/octo-org/octo-repo/runs/399444496",
      "status": "completed",
      "conclusion": "success",
      "started_at": "2020-01-20T17:42:40Z",
      "completed_at": "2020-01-20T17:44:39Z",
      "name": "build",
      "steps": [
        {
          "name": "Set up job",
          "status": "completed",
          "conclusion": "success",
          "number": 1,
          "started_at": "2020-01-20T09:42:40.000-08:00",
          "completed_at": "2020-01-20T09:42:41.000-08:00"
        },
        {
          "name": "Run actions/checkout@v2",
          "status": "completed",
          "conclusion": "success",
          "number": 2,
          "started_at": "2020-01-20T09:42:41.000-08:00",
          "completed_at": "2020-01-20T09:42:45.000-08:00"
        },
        {
          "name": "Set up Ruby",
          "status": "completed",
          "conclusion": "success",
          "number": 3,
          "started_at": "2020-01-20T09:42:45.000-08:00",
          "completed_at": "2020-01-20T09:42:45.000-08:00"
        },
        {
          "name": "Run actions/cache@v2",
          "status": "completed",
          "conclusion": "success",
          "number": 4,
          "started_at": "2020-01-20T09:42:45.000-08:00",
          "completed_at": "2020-01-20T09:42:48.000-08:00"
        },
        {
          "name": "Install Bundler",
          "status": "completed",
          "conclusion": "success",
          "number": 5,
          "started_at": "2020-01-20T09:42:48.000-08:00",
          "completed_at": "2020-01-20T09:42:52.000-08:00"
        },
        {
          "name": "Install Gems",
          "status": "completed",
          "conclusion": "success",
          "number": 6,
          "started_at": "2020-01-20T09:42:52.000-08:00",
          "completed_at": "2020-01-20T09:42:53.000-08:00"
        },
        {
          "name": "Run Tests",
          "status": "completed",
          "conclusion": "success",
          "number": 7,
          "started_at": "2020-01-20T09:42:53.000-08:00",
          "completed_at": "2020-01-20T09:42:59.000-08:00"
        },
        {
          "name": "Deploy to Heroku",
          "status": "completed",
          "conclusion": "success",
          "number": 8,
          "started_at": "2020-01-20T09:42:59.000-08:00",
          "completed_at": "2020-01-20T09:44:39.000-08:00"
        },
        {
          "name": "Post actions/cache@v2",
          "status": "completed",
          "conclusion": "success",
          "number": 16,
          "started_at": "2020-01-20T09:44:39.000-08:00",
          "completed_at": "2020-01-20T09:44:39.000-08:00"
        },
        {
          "name": "Complete job",
          "status": "completed",
          "conclusion": "success",
          "number": 17,
          "started_at": "2020-01-20T09:44:39.000-08:00",
          "completed_at": "2020-01-20T09:44:39.000-08:00"
        }
      ],
      "check_run_url": "https://api.github.com/repos/octo-org/octo-repo/check-runs/399444496"
    }
  ]
}

Get a workflow job

Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.

GET /repos/:owner/:repo/actions/jobs/:job_id

Response

Status: 202 Accepted
{
  "id": 399444496,
  "run_id": 29679449,
  "run_url": "https://api.github.com/repos/octo-org/octo-repo/actions/runs/29679449",
  "node_id": "MDEyOldvcmtmbG93IEpvYjM5OTQ0NDQ5Ng==",
  "head_sha": "f83a356604ae3c5d03e1b46ef4d1ca77d64a90b0",
  "url": "https://api.github.com/repos/octo-org/octo-repo/actions/jobs/399444496",
  "html_url": "https://github.com/octo-org/octo-repo/runs/399444496",
  "status": "completed",
  "conclusion": "success",
  "started_at": "2020-01-20T17:42:40Z",
  "completed_at": "2020-01-20T17:44:39Z",
  "name": "build",
  "steps": [
    {
      "name": "Set up job",
      "status": "completed",
      "conclusion": "success",
      "number": 1,
      "started_at": "2020-01-20T09:42:40.000-08:00",
      "completed_at": "2020-01-20T09:42:41.000-08:00"
    },
    {
      "name": "Run actions/checkout@v2",
      "status": "completed",
      "conclusion": "success",
      "number": 2,
      "started_at": "2020-01-20T09:42:41.000-08:00",
      "completed_at": "2020-01-20T09:42:45.000-08:00"
    },
    {
      "name": "Set up Ruby",
      "status": "completed",
      "conclusion": "success",
      "number": 3,
      "started_at": "2020-01-20T09:42:45.000-08:00",
      "completed_at": "2020-01-20T09:42:45.000-08:00"
    },
    {
      "name": "Run actions/cache@v2",
      "status": "completed",
      "conclusion": "success",
      "number": 4,
      "started_at": "2020-01-20T09:42:45.000-08:00",
      "completed_at": "2020-01-20T09:42:48.000-08:00"
    },
    {
      "name": "Install Bundler",
      "status": "completed",
      "conclusion": "success",
      "number": 5,
      "started_at": "2020-01-20T09:42:48.000-08:00",
      "completed_at": "2020-01-20T09:42:52.000-08:00"
    },
    {
      "name": "Install Gems",
      "status": "completed",
      "conclusion": "success",
      "number": 6,
      "started_at": "2020-01-20T09:42:52.000-08:00",
      "completed_at": "2020-01-20T09:42:53.000-08:00"
    },
    {
      "name": "Run Tests",
      "status": "completed",
      "conclusion": "success",
      "number": 7,
      "started_at": "2020-01-20T09:42:53.000-08:00",
      "completed_at": "2020-01-20T09:42:59.000-08:00"
    },
    {
      "name": "Deploy to Heroku",
      "status": "completed",
      "conclusion": "success",
      "number": 8,
      "started_at": "2020-01-20T09:42:59.000-08:00",
      "completed_at": "2020-01-20T09:44:39.000-08:00"
    },
    {
      "name": "Post actions/cache@v2",
      "status": "completed",
      "conclusion": "success",
      "number": 16,
      "started_at": "2020-01-20T09:44:39.000-08:00",
      "completed_at": "2020-01-20T09:44:39.000-08:00"
    },
    {
      "name": "Complete job",
      "status": "completed",
      "conclusion": "success",
      "number": 17,
      "started_at": "2020-01-20T09:44:39.000-08:00",
      "completed_at": "2020-01-20T09:44:39.000-08:00"
    }
  ],
  "check_run_url": "https://api.github.com/repos/octo-org/octo-repo/check-runs/399444496"
}

List workflow job logs

Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for Location: in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. GitHub Apps must have the actions permission to use this endpoint.

GET /repos/:owner/:repo/actions/jobs/:job_id/logs

Example

Call this endpoint using the -v flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the -o flag.

curl -v -L -u octocat:$token -o logs.zip /
"https://api.github.com/repos/octo-org/octo-repo/jobs/4511116/logs"

Response

Status: 302 Found
Location: https://pipelines.actions.githubusercontent.com/ab1f3cCFPB34Nd6imvFxpGZH5hNlDp2wijMwl2gDoO0bcrrlJj/_apis/pipelines/1/jobs/19/signedlogcontent?urlExpires=2020-01-22T22%3A44%3A54.1389777Z&urlSigningMethod=HMACV1&urlSignature=2TUDfIg4fm36OJmfPy6km5QD5DLCOkBVzvhWZM8B%2BUY%3D