Skip to main content

workflow_runs

Creates, updates, deletes, gets or lists a workflow_runs resource.

Overview

Nameworkflow_runs
TypeResource
Idgithub.actions.workflow_runs

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe ID of the workflow run.
namestringThe name of the workflow run. (example: Build)
check_suite_idintegerThe ID of the associated check suite.
check_suite_node_idstringThe node ID of the associated check suite. (example: MDEwOkNoZWNrU3VpdGU0Mg==)
head_repository_idinteger
node_idstring (example: MDEwOkNoZWNrU3VpdGU1)
workflow_idintegerThe ID of the parent workflow.
actorobjectA GitHub user. (title: Simple User)
artifacts_urlstringThe URL to the artifacts for the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/rerun/artifacts)
cancel_urlstringThe URL to cancel the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/cancel)
check_suite_urlstringThe URL to the associated check suite. (example: https://api.github.com/repos/github/hello-world/check-suites/12)
conclusionstring (example: neutral)
created_atstring (date-time)
display_titlestringThe event-specific title associated with the run or the run-name if set, or the value of run-name if it is set in the workflow. (example: Simple Workflow)
eventstring (example: push)
head_branchstring (example: master)
head_commitobjectA commit. (title: Simple Commit)
head_repositoryobjectMinimal Repository (title: Minimal Repository)
head_shastringThe SHA of the head commit that points to the version of the workflow being run. (example: 009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d)
html_urlstring (example: https://github.com/github/hello-world/suites/4)
jobs_urlstringThe URL to the jobs for the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/jobs)
logs_urlstringThe URL to download the logs for the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/logs)
pathstringThe full path of the workflow (example: octocat/octo-repo/.github/workflows/ci.yml@main)
previous_attempt_urlstringThe URL to the previous attempted run of this workflow, if one exists. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/attempts/3)
pull_requestsarrayPull requests that are open with a head_sha or head_branch that matches the workflow run. The returned pull requests do not necessarily indicate pull requests that triggered the run.
referenced_workflowsarray
repositoryobjectMinimal Repository (title: Minimal Repository)
rerun_urlstringThe URL to rerun the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5/rerun)
run_attemptintegerAttempt number of the run, 1 for first attempt and higher if the workflow was re-run.
run_numberintegerThe auto incrementing run number for the workflow run.
run_started_atstring (date-time)The start time of the latest run. Resets on re-run.
statusstring (example: completed)
triggering_actorobjectA GitHub user. (title: Simple User)
updated_atstring (date-time)
urlstringThe URL to the workflow run. (example: https://api.github.com/repos/github/hello-world/actions/runs/5)
workflow_urlstringThe URL to the workflow. (example: https://api.github.com/repos/github/hello-world/actions/workflows/main.yaml)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_workflow_run_attemptselectowner, repo, run_id, attempt_numberexclude_pull_requestsGets a specific workflow run attempt.

Anyone with read access to the repository can use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
get_workflow_runselectowner, repo, run_idexclude_pull_requestsGets a specific workflow run.

Anyone with read access to the repository can use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
list_workflow_runsselectowner, repo, workflow_idactor, branch, event, status, per_page, page, created, exclude_pull_requests, check_suite_id, head_shaList all workflow runs for a workflow. You can replace workflow_id with the workflow file name. For example, you could use main.yaml. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.

Anyone with read access to the repository can use this endpoint

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

This endpoint will return up to 1,000 results for each search when using the following parameters: actor, branch, check_suite_id, created, event, head_sha, status.
list_workflow_runs_for_reposelectowner, repoactor, branch, event, status, per_page, page, created, exclude_pull_requests, check_suite_id, head_shaLists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see Parameters.

Anyone with read access to the repository can use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

This endpoint will return up to 1,000 results for each search when using the following parameters: actor, branch, check_suite_id, created, event, head_sha, status.
force_cancel_workflow_runinsertowner, repo, run_idCancels a workflow run and bypasses conditions that would otherwise cause a workflow execution to continue, such as an always() condition on a job.
You should only use this endpoint to cancel a workflow run when the workflow run is not responding to POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
delete_workflow_rundeleteowner, repo, run_idDeletes a specific workflow run.

Anyone with write access to the repository can use this endpoint.

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
re_run_job_for_workflow_runexecowner, repo, job_idRe-run a job and its dependent jobs in a workflow run.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
approve_workflow_runexecowner, repo, run_idApproves a workflow run for a pull request from a public fork of a first time contributor. For more information, see "Approving workflow runs from public forks."

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
cancel_workflow_runexecowner, repo, run_idCancels a workflow run using its id.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
review_custom_gates_for_runexecowner, repo, run_id, environment_name, comment, stateApprove or reject custom deployment protection rules provided by a GitHub App for a workflow run. For more information, see "Using environments for deployment."

> [!NOTE]
> GitHub Apps can only review their own custom deployment protection rules. To approve or reject pending deployments that are waiting for review from a specific person or team, see POST /repos/{owner}/{repo}/actions/runs/{run_id}/pending_deployments.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.
re_run_workflowexecowner, repo, run_idRe-runs your workflow run using its id.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
re_run_workflow_failed_jobsexecowner, repo, run_idRe-run all of the failed jobs and their dependent jobs in a workflow run using the id of the workflow run.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
attempt_numberintegerThe attempt number of the workflow run.
job_idintegerThe unique identifier of the job.
ownerstringThe account owner of the repository. The name is not case sensitive.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
run_idintegerThe unique identifier of the workflow run.
workflow_idThe ID of the workflow. You can also pass the workflow file name as a string.
actorstringReturns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run.
branchstringReturns workflow runs associated with a branch. Use the name of the branch of the push.
check_suite_idintegerReturns workflow runs with the check_suite_id that you specify.
createdstring (date-time)Returns workflow runs created within the given date-time range. For more information on the syntax, see "Understanding the search syntax."
eventstringReturns workflow run triggered by the event you specify. For example, push, pull_request or issue. For more information, see "Events that trigger workflows."
exclude_pull_requestsbooleanIf true pull requests are omitted from the response (empty array).
head_shastringOnly returns workflow runs that are associated with the specified head_sha.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
statusstringReturns workflow runs with the check run status or conclusion that you specify. For example, a conclusion can be success or a status can be in_progress. Only GitHub Actions can set a status of waiting, pending, or requested.

SELECT examples

Gets a specific workflow run attempt.

Anyone with read access to the repository can use this endpoint.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint with a private repository.

SELECT
id,
name,
check_suite_id,
check_suite_node_id,
head_repository_id,
node_id,
workflow_id,
actor,
artifacts_url,
cancel_url,
check_suite_url,
conclusion,
created_at,
display_title,
event,
head_branch,
head_commit,
head_repository,
head_sha,
html_url,
jobs_url,
logs_url,
path,
previous_attempt_url,
pull_requests,
referenced_workflows,
repository,
rerun_url,
run_attempt,
run_number,
run_started_at,
status,
triggering_actor,
updated_at,
url,
workflow_url
FROM github.actions.workflow_runs
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND run_id = '{{ run_id }}' -- required
AND attempt_number = '{{ attempt_number }}' -- required
AND exclude_pull_requests = '{{ exclude_pull_requests }}'
;

INSERT examples

Cancels a workflow run and bypasses conditions that would otherwise cause a workflow execution to continue, such as an always() condition on a job.
You should only use this endpoint to cancel a workflow run when the workflow run is not responding to POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

INSERT INTO github.actions.workflow_runs (
owner,
repo,
run_id
)
SELECT
'{{ owner }}',
'{{ repo }}',
'{{ run_id }}'
;

DELETE examples

Deletes a specific workflow run.

Anyone with write access to the repository can use this endpoint.

If the repository is private, OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.

DELETE FROM github.actions.workflow_runs
WHERE owner = '{{ owner }}' --required
AND repo = '{{ repo }}' --required
AND run_id = '{{ run_id }}' --required
;

Lifecycle Methods

Re-run a job and its dependent jobs in a workflow run.

OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.

EXEC github.actions.workflow_runs.re_run_job_for_workflow_run 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@job_id='{{ job_id }}' --required
@@json=
'{
"enable_debug_logging": {{ enable_debug_logging }}
}'
;