Skip to main content

workflows

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

Overview

Nameworkflows
TypeResource
Idgithub.actions.workflows

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idinteger
namestring (example: CI)
node_idstring (example: MDg6V29ya2Zsb3cxMg==)
badge_urlstring (example: https://github.com/actions/setup-ruby/workflows/CI/badge.svg)
created_atstring (date-time) (example: 2019-12-06T14:20:20.000Z)
deleted_atstring (date-time) (example: 2019-12-06T14:20:20.000Z)
html_urlstring (example: https://github.com/actions/setup-ruby/blob/master/.github/workflows/ruby.yaml)
pathstring (example: ruby.yaml)
statestring (active, deleted, disabled_fork, disabled_inactivity, disabled_manually) (example: active)
updated_atstring (date-time) (example: 2019-12-06T14:20:20.000Z)
urlstring (example: https://api.github.com/repos/actions/setup-ruby/workflows/5)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_workflowselectowner, repo, workflow_idGets a specific workflow. You can replace workflow_id with the workflow
file name. For example, you could use main.yaml.

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_repo_workflowsselectowner, repoper_page, pageLists the workflows in a repository.

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.
create_workflow_dispatchinsertowner, repo, workflow_id, refYou can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.

You must configure your GitHub Actions workflow to run when the workflow_dispatch webhook event occurs. The inputs are configured in the workflow file. For more information about how to configure the workflow_dispatch event in the workflow file, see "Events that trigger workflows."

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
disable_workflowexecowner, repo, workflow_idDisables a workflow and sets the state of the workflow to disabled_manually. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.

OAuth tokens and personal access tokens (classic) need the repo scope to use this endpoint.
enable_workflowexecowner, repo, workflow_idEnables a workflow and sets the state of the workflow to active. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.

OAuth 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
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.
workflow_idThe ID of the workflow. You can also pass the workflow file name as a string.
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."

SELECT examples

Gets a specific workflow. You can replace workflow_id with the workflow
file name. For example, you could use main.yaml.

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,
node_id,
badge_url,
created_at,
deleted_at,
html_url,
path,
state,
updated_at,
url
FROM github.actions.workflows
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND workflow_id = '{{ workflow_id }}' -- required
;

INSERT examples

You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.

You must configure your GitHub Actions workflow to run when the workflow_dispatch webhook event occurs. The inputs are configured in the workflow file. For more information about how to configure the workflow_dispatch event in the workflow file, see "Events that trigger workflows."

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

INSERT INTO github.actions.workflows (
ref,
inputs,
return_run_details,
owner,
repo,
workflow_id
)
SELECT
'{{ ref }}' /* required */,
'{{ inputs }}',
{{ return_run_details }},
'{{ owner }}',
'{{ repo }}',
'{{ workflow_id }}'
RETURNING
workflow_run_id,
html_url,
run_url
;

Lifecycle Methods

Disables a workflow and sets the state of the workflow to disabled_manually. You can replace workflow_id with the workflow file name. For example, you could use main.yaml.

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

EXEC github.actions.workflows.disable_workflow 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@workflow_id='{{ workflow_id }}' --required
;