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>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
FromWorkflowRun¶
Get-GitHubArtifact -Owner <String> -Repository <String> -WorkflowRunID <String> [-Name <String>] [-AllVersions]
[-Context <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
ById¶
Get-GitHubArtifact -Owner <String> -Repository <String> -ID <String> [-Context <Object>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
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¶
-Owner¶
The owner of the repository (GitHub user or org name).
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Repository¶
The name of the repository without the .git extension.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-ID¶
Retrieves a single artifact by its unique ID.
Type: String
Parameter Sets: ById
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WorkflowRunID¶
Retrieves artifacts from a specific workflow run.
Type: String
Parameter Sets: FromWorkflowRun
Aliases: WorkflowRun
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-Name¶
Retrieves artifacts by name or all artifacts across a repo.
Type: String
Parameter Sets: FromRepository, FromWorkflowRun
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True
-AllVersions¶
Return all versions of artifacts.
Type: SwitchParameter
Parameter Sets: FromRepository, FromWorkflowRun
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-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: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-GitHubContext)
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS¶
OUTPUTS¶
GitHubArtifact[]¶
NOTES¶
RELATED LINKS¶
https://psmodule.io/GitHub/Functions/Artifacts/Get-GitHubArtifact/