codeql_variant_analyses
Creates, updates, deletes, gets or lists a codeql_variant_analyses resource.
Overview
| Name | codeql_variant_analyses |
| Type | Resource |
| Id | github.code_scanning.codeql_variant_analyses |
Fields
The following fields are returned by SELECT queries:
- get_variant_analysis
Response
| Name | Datatype | Description |
|---|---|---|
id | integer | The ID of the variant analysis. |
actions_workflow_run_id | integer | The GitHub Actions workflow run used to execute this variant analysis. This is only available if the workflow run has started. |
actor | object | A GitHub user. (title: Simple User) |
completed_at | string (date-time) | The date and time at which the variant analysis was completed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the variant analysis has not yet completed or this information is not available. |
controller_repo | object | A GitHub repository. (title: Simple Repository) |
created_at | string (date-time) | The date and time at which the variant analysis was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. |
failure_reason | string | The reason for a failure of the variant analysis. This is only available if the variant analysis has failed. (no_repos_queried, actions_workflow_run_failed, internal_error) |
query_language | string | The language targeted by the CodeQL query (actions, cpp, csharp, go, java, javascript, python, ruby, rust, swift) |
query_pack_url | string | The download url for the query pack. |
scanned_repositories | array | |
skipped_repositories | object | Information about repositories that were skipped from processing. This information is only available to the user that initiated the variant analysis. |
status | string | (in_progress, succeeded, failed, cancelled) |
updated_at | string (date-time) | The date and time at which the variant analysis was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_variant_analysis | select | owner, repo, codeql_variant_analysis_id | Gets the summary of a CodeQL variant analysis. OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories. | |
create_variant_analysis | insert | owner, repo, language, query_pack, repositories, repository_lists, repository_owners | Creates a new CodeQL variant analysis, which will run a CodeQL query against one or more repositories. Get started by learning more about running CodeQL queries at scale with Multi-Repository Variant Analysis. Use the owner and repo parameters in the URL to specify the controller repository thatwill be used for running GitHub Actions workflows and storing the results of the CodeQL variant analysis. 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.
| Name | Datatype | Description |
|---|---|---|
codeql_variant_analysis_id | integer | The unique identifier of the variant analysis. |
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. |
SELECT examples
- get_variant_analysis
Gets the summary of a CodeQL variant analysis.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint with private or public repositories, or the public_repo scope to use this endpoint with only public repositories.
SELECT
id,
actions_workflow_run_id,
actor,
completed_at,
controller_repo,
created_at,
failure_reason,
query_language,
query_pack_url,
scanned_repositories,
skipped_repositories,
status,
updated_at
FROM github.code_scanning.codeql_variant_analyses
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND codeql_variant_analysis_id = '{{ codeql_variant_analysis_id }}' -- required
;
INSERT examples
- create_variant_analysis
- Manifest
Creates a new CodeQL variant analysis, which will run a CodeQL query against one or more repositories.
Get started by learning more about running CodeQL queries at scale with Multi-Repository Variant Analysis.
Use the owner and repo parameters in the URL to specify the controller repository that
will be used for running GitHub Actions workflows and storing the results of the CodeQL variant analysis.
OAuth app tokens and personal access tokens (classic) need the repo scope to use this endpoint.
INSERT INTO github.code_scanning.codeql_variant_analyses (
language,
query_pack,
repositories,
repository_lists,
repository_owners,
owner,
repo
)
SELECT
'{{ language }}' /* required */,
'{{ query_pack }}' /* required */,
'{{ repositories }}' /* required */,
'{{ repository_lists }}' /* required */,
'{{ repository_owners }}' /* required */,
'{{ owner }}',
'{{ repo }}'
RETURNING
id,
actions_workflow_run_id,
actor,
completed_at,
controller_repo,
created_at,
failure_reason,
query_language,
query_pack_url,
scanned_repositories,
skipped_repositories,
status,
updated_at
;
# Description fields are for documentation purposes
- name: codeql_variant_analyses
props:
- name: owner
value: "{{ owner }}"
description: Required parameter for the codeql_variant_analyses resource.
- name: repo
value: "{{ repo }}"
description: Required parameter for the codeql_variant_analyses resource.
- name: language
value: "{{ language }}"
description: |
The language targeted by the CodeQL query
valid_values: ['actions', 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'rust', 'swift']
- name: query_pack
value: "{{ query_pack }}"
description: |
A Base64-encoded tarball containing a CodeQL query and all its dependencies
- name: repositories
value:
- "{{ repositories }}"
description: |
List of repository names (in the form `owner/repo-name`) to run the query against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.
- name: repository_lists
value:
- "{{ repository_lists }}"
description: |
List of repository lists to run the query against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.
- name: repository_owners
value:
- "{{ repository_owners }}"
description: |
List of organization or user names whose repositories the query should be run against. Precisely one property from `repositories`, `repository_lists` and `repository_owners` is required.