Skip to content

Save-GitHubArtifact

SYNOPSIS

Downloads a GitHub Actions artifact.

SYNTAX

__AllParameterSets

Save-GitHubArtifact [-Owner] <string> [-Repository] <string> [-ID] <string> [[-Path] <string>]
 [[-Context] <Object>] [-Expand] [-Force] [-PassThru] [<CommonParameters>]

ALIASES

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

DESCRIPTION

Downloads an artifact from a repository. The artifact is downloaded as a ZIP file to the specified path or the current directory by default. Users must have read access to the repository. For private repositories, personal access tokens (classic) or OAuth tokens with the repo scope are required.

EXAMPLES

EXAMPLE 1

Save-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World' -ID '123456' -Path 'C:\Artifacts'

Output:

Directory: C:\Artifacts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        03/31/2025     12:00                artifact-123456.zip

Downloads artifact ID '123456' from the 'Hello-World' repository owned by 'octocat' to the specified path.

EXAMPLE 2

Save-GitHubArtifact -Owner 'octocat' -Repository 'Hello-World' -Name 'module' -Path 'C:\Artifacts\module' -Expand -Force

Output:

Directory: C:\Artifacts

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        03/31/2025     12:00                artifact-123456.zip

Downloads artifact ID 123456 from the 'Hello-World' repository owned by 'octocat' to the specified path, overwriting existing files during download and extraction.

PARAMETERS

-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: 4
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Expand

When specified, the ZIP file is extracted to the same directory it was downloaded to.

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

-Force

When specified, overwrites existing files during download and extraction.

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: ''

-ID

The unique identifier of the artifact.

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

-Owner

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

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

-PassThru

When specified, the ZIP file or the folder where the ZIP file was extracted to is returned.

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: ''

-Path

Path to the file or folder for the download. Accepts relative or absolute paths.

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

-Repository

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

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  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

GitHubArtifact

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

System.IO.FileSystemInfo

{{ Fill in the Description }}

NOTES

Get an artifact