workflows
Creates, updates, deletes, gets or lists a workflows resource.
Overview
| Name | workflows |
| Type | Resource |
| Id | github.actions.workflows |
Fields
The following fields are returned by SELECT queries:
- get_workflow
- list_repo_workflows
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | |
name | string | (example: CI) |
node_id | string | (example: MDg6V29ya2Zsb3cxMg==) |
badge_url | string | (example: https://github.com/actions/setup-ruby/workflows/CI/badge.svg) |
created_at | string (date-time) | (example: 2019-12-06T14:20:20.000Z) |
deleted_at | string (date-time) | (example: 2019-12-06T14:20:20.000Z) |
html_url | string | (example: https://github.com/actions/setup-ruby/blob/master/.github/workflows/ruby.yaml) |
path | string | (example: ruby.yaml) |
state | string | (active, deleted, disabled_fork, disabled_inactivity, disabled_manually) (example: active) |
updated_at | string (date-time) | (example: 2019-12-06T14:20:20.000Z) |
url | string | (example: https://api.github.com/repos/actions/setup-ruby/workflows/5) |
Response
| Name | Datatype | Description |
|---|---|---|
total_count | integer | |
workflows | array |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_workflow | select | owner, repo, workflow_id | Gets a specific workflow. You can replace workflow_id with the workflowfile 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_workflows | select | owner, repo | per_page, page | Lists 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_dispatch | insert | owner, repo, workflow_id, ref | 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. | |
disable_workflow | exec | owner, repo, workflow_id | 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. | |
enable_workflow | exec | owner, repo, workflow_id | Enables 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.
| Name | Datatype | Description |
|---|---|---|
owner | string | The account owner of the repository. The name is not case sensitive. |
repo | string | The name of the repository without the .git extension. The name is not case sensitive. |
workflow_id | | The ID of the workflow. You can also pass the workflow file name as a string. |
page | integer | The page number of the results to fetch. For more information, see "Using pagination in the REST API." |
per_page | integer | The number of results per page (max 100). For more information, see "Using pagination in the REST API." |
SELECT examples
- get_workflow
- list_repo_workflows
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
;
Lists 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.
SELECT
total_count,
workflows
FROM github.actions.workflows
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND per_page = '{{ per_page }}'
AND page = '{{ page }}'
;
INSERT examples
- create_workflow_dispatch
- Manifest
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
;
# Description fields are for documentation purposes
- name: workflows
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the workflows resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the workflows resource.
- name: workflow_id
value: "{{ workflow_id }}"
description: Required parameter for the workflows resource.
- name: ref
value: "{{ ref }}"
description: |
The git reference for the workflow. The reference can be a branch or tag name.
- name: inputs
value: "{{ inputs }}"
description: |
Input keys and values configured in the workflow file. The maximum number of properties is 25. Any default properties configured in the workflow file will be used when `inputs` are omitted.
- name: return_run_details
value: {{ return_run_details }}
description: |
Whether the response should include the workflow run ID and URLs.
Lifecycle Methods
- disable_workflow
- enable_workflow
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
;
Enables 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.
EXEC github.actions.workflows.enable_workflow
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@workflow_id='{{ workflow_id }}' --required
;