Skip to main content

codeql_variant_analyses

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

Overview

Namecodeql_variant_analyses
TypeResource
Idgithub.code_scanning.codeql_variant_analyses

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
idintegerThe ID of the variant analysis.
actions_workflow_run_idintegerThe GitHub Actions workflow run used to execute this variant analysis. This is only available if the workflow run has started.
actorobjectA GitHub user. (title: Simple User)
completed_atstring (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_repoobjectA GitHub repository. (title: Simple Repository)
created_atstring (date-time)The date and time at which the variant analysis was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
failure_reasonstringThe 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_languagestringThe language targeted by the CodeQL query (actions, cpp, csharp, go, java, javascript, python, ruby, rust, swift)
query_pack_urlstringThe download url for the query pack.
scanned_repositoriesarray
skipped_repositoriesobjectInformation about repositories that were skipped from processing. This information is only available to the user that initiated the variant analysis.
statusstring (in_progress, succeeded, failed, cancelled)
updated_atstring (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:

NameAccessible byRequired ParamsOptional ParamsDescription
get_variant_analysisselectowner, repo, codeql_variant_analysis_idGets 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_analysisinsertowner, repo, language, query_pack, repositories, repository_lists, repository_ownersCreates 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.

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
codeql_variant_analysis_idintegerThe unique identifier of the variant analysis.
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.

SELECT examples

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

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
;