Skip to content

Remove-GitHubArtifact

SYNOPSIS

Deletes an artifact from a GitHub repository by its unique ID.

SYNTAX

Remove-GitHubArtifact [-Owner] <String> [-Repository] <String> [-ID] <String> [[-Context] <Object>]
 [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Deletes an artifact associated with a workflow run in a GitHub repository. The user must provide the repository owner, repository name, and the artifact ID. OAuth tokens and personal access tokens (classic) must have the repo scope to use this endpoint. The function uses the GitHub REST API to perform the deletion and supports ShouldProcess for safe execution.

EXAMPLES

EXAMPLE 1

Remove-GitHubArtifact -Owner 'octocat' -Repository 'demo-repo' -ID '123456'

Deletes the artifact with ID 123456 from the repository 'demo-repo' owned by 'octocat'.

PARAMETERS

-Owner

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

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Repository

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

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ID

The unique identifier of the artifact.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
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: 4
Default value: (Get-GitHubContext)
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
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

GitHubArtifact

OUTPUTS

void

NOTES

This function does not return any output. It performs a delete operation against the GitHub REST API and is silent on success.

https://psmodule.io/GitHub/Functions/Actions/Remove-GitHubArtifact/

[Delete an artifact](https://docs.github.com/rest/actions/artifacts#delete-an-artifact)