Get-GitHubCodeScanningRecentAnalyses

SYNOPSIS

List code scanning analyses for a repository

SYNTAX

__AllParameterSets

Get-GitHubCodeScanningRecentAnalyses [-Owner] <string> [-Repo] <string> [-ToolName <string>]
 [-ToolGuid <string>] [-Page <long>] [-PerPage <long>] [-Pr <long>] [-Ref <string>]
 [-SarifId <string>] [-Direction <string>] [-Sort <string>] [-AllResults] [-Accept <string>]

ALIASES

This cmdlet has the following aliases,

  • Get-GHCodeScanningRecentAnalyses

DESCRIPTION

The Get-GitHubCodeScanningRecentAnalyses cmdlet invokes the GET method of the /repos/{owner}/{repo}/code-scanning/analyses endpoint (List code scanning analyses for a repository)

Lists the details of all code scanning analyses for a repository, starting with the most recent. The response is paginated and you can use the ‘page’ and ‘per_page’ parameters to list the analyses you’re interested in. By default 30 analyses are listed per page.

The ‘rules_count’ field in the response give the number of rules that were run in the analysis. For very old analyses this data is not available, and ‘0’ is returned in this field. [!WARNING] Closing down notice: The ‘tool_name’ field is closing down and will, in future, not be included in the response for this endpoint. The example response reflects this change. The tool name can now be found inside the ‘tool’ field.

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.

Endpoint: GET /repos/{owner}/{repo}/code-scanning/analyses API version: 2026-03-10

EXAMPLES

EXAMPLE 1

Get-GitHubCodeScanningRecentAnalyses -Owner 'octocat' -Repo 'Hello-World'

Invokes GET /repos/{owner}/{repo}/code-scanning/analyses

EXAMPLE 2

Get-GitHubCodeScanningRecentAnalyses -Owner 'octocat' -Repo 'Hello-World' -AllResults

Returns the items of every page

PARAMETERS

-Accept

The Accept header (media type) of the request Default value: application/vnd.github+json

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AllResults

Follows the pagination links & returns the items of every page. 100 items are requested per page unless the per page parameter is used

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Direction

The direction to sort the results by.

Query parameter [ direction ]

Default value: desc

Allowed values: ‘asc’, ‘desc’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Owner

The account owner of the repository. The name is not case sensitive.

Path parameter [ owner ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Page

The page number of the results to fetch. For more information, see “Using pagination in the REST API (https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).”

Query parameter [ page ]

Default value: 1

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-PerPage

The number of results per page (max 100). For more information, see “Using pagination in the REST API (https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api).”

Query parameter [ per_page ]

Default value: 30

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Pr

The number of the pull request for the results you want to list.

Query parameter [ pr ]

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Ref

The Git reference for the analyses you want to list. The ‘ref’ for a branch can be formatted either as ‘refs/heads/' or simply ''. To reference a pull request use 'refs/pull//merge'.

Query parameter [ ref ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Repo

The name of the repository without the ‘.git’ extension. The name is not case sensitive.

Path parameter [ repo ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SarifId

Filter analyses belonging to the same SARIF upload.

Query parameter [ sarif_id ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Sort

The property by which to sort the results.

Query parameter [ sort ]

Default value: created

Allowed values: ‘created’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ToolGuid

The GUID of a code scanning tool. Only results by this tool will be listed. Note that some code scanning tools may not include a GUID in their analysis data. You can specify the tool by using either ‘tool_guid’ or ‘tool_name’, but not both.

Query parameter [ tool_guid ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ToolName

The name of a code scanning tool. Only results by this tool will be listed. You can specify the tool by using either ‘tool_name’ or ‘tool_guid’, but not both.

Query parameter [ tool_name ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Objects with properties named like the path parameters can be piped to this function

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: code-scanning/list-recent-analyses Category: code-scanning / code-scanning