Skip to content

Get-GitHubArtifact

SYNOPSIS

Retrieves GitHub Actions artifacts from a repository or workflow run.

SYNTAX

FromRepository (Default)

Get-GitHubArtifact -Owner <string> -Repository <string> [-Name <string>] [-AllVersions]
 [-Context <Object>] [<CommonParameters>]

FromWorkflowRun

Get-GitHubArtifact -Owner <string> -Repository <string> -WorkflowRunID <string> [-Name <string>]
 [-AllVersions] [-Context <Object>] [<CommonParameters>]

ById

Get-GitHubArtifact -Owner <string> -Repository <string> -ID <string> [-Context <Object>]
 [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

This function fetches GitHub Actions artifacts by artifact ID, workflow run ID, or directly from a repository. It supports filtering by artifact name (with wildcards) and can optionally retrieve all versions of the artifacts. Artifacts contain metadata such as name, size, ID, and creation date. The function supports multiple parameter sets: - ById: Retrieve a specific artifact by its ID. - FromWorkflowRun: Retrieve artifacts from a specific workflow run. - FromRepository: Retrieve artifacts from a repository, optionally by name or with all versions.

EXAMPLES

EXAMPLE 1

Get-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World' -ID '123456'

Output:

Name        : artifact-1
ID          : 123456
SizeInBytes : 2048
CreatedAt   : 2024-12-01T10:00:00Z

Retrieves a single GitHub Actions artifact using its unique artifact ID.

EXAMPLE 2

Get-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World' -WorkflowRunID '987654321'

Output:

Name        : test-results
ID          : 456789
SizeInBytes : 4096
CreatedAt   : 2025-01-15T15:25:00Z

Retrieves the latest version of all artifacts from the specified workflow run.

EXAMPLE 3

Get-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World' -WorkflowRunID '987654321' -AllVersions

Output:

Name        : test-results
ID          : 4564584673
SizeInBytes : 4096
CreatedAt   : 2025-01-15T14:25:00Z

Name        : test-results
ID          : 4564584674
SizeInBytes : 4096
CreatedAt   : 2025-01-15T15:25:00Z

Retrieves all versions of all artifacts from the specified workflow run.

EXAMPLE 4

Get-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World'

Output:

Name        : build-artifact
ID          : 998877
SizeInBytes : 8192
CreatedAt   : 2025-02-01T09:45:00Z

Retrieves the latest version of all artifacts from the specified repository.

PARAMETERS

-AllVersions

Return all versions of artifacts.

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

-Context

The context to run the command in. Used to get the details for the API call. Can be either a string or a GitHubContext object.

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

-ID

Retrieves a single artifact by its unique ID.

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

-Name

Retrieves artifacts by name or all artifacts across a repo.

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

-Owner

The owner of the repository (GitHub user or org name).

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: FromRepository
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: FromWorkflowRun
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: ById
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Repository

The name of the repository without the .git extension.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: FromRepository
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: FromWorkflowRun
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
- Name: ById
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WorkflowRunID

Retrieves artifacts from a specific workflow run.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases:
- WorkflowRun
ParameterSets:
- Name: FromWorkflowRun
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  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

System.String

{{ Fill in the Description }}

OUTPUTS

GitHubArtifact

{{ Fill in the Description }}

NOTES