From aae5fc81866af34906244af067bd63fe69eb6116 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:37:08 -0800 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools repository (#1418) --- eng/common/scripts/Delete-RemoteTag.ps1 | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 eng/common/scripts/Delete-RemoteTag.ps1 diff --git a/eng/common/scripts/Delete-RemoteTag.ps1 b/eng/common/scripts/Delete-RemoteTag.ps1 new file mode 100644 index 000000000..a3157c7ab --- /dev/null +++ b/eng/common/scripts/Delete-RemoteTag.ps1 @@ -0,0 +1,33 @@ +param( + $Repository, + $Tag, + $AuthToken +) + +. (Join-Path $PSScriptRoot common.ps1) + +$repositoryParts = $Repository.Split("/") + +if ($repositoryParts.Length -ne 2) +{ + LogError "Repository is not a valid format." +} + +$repositoryOwner = $repositoryParts[0] +LogDebug "Repository owner is: $repositoryOwner" + +$repositoryName = $repositoryParts[1] +LogDebug "Reposiory name is: $repositoryName" + +$ref = "tags/$Tag" +LogDebug "Calculated ref is: $ref" + +try +{ + Remove-GitHubSourceReferences -RepoOwner $repositoryOwner -RepoName $repositoryName -Ref $ref -AuthToken $AuthToken +} +catch +{ + LogError "Remove-GitHubSourceReferences failed with exception:`n$_" + exit 1 +} \ No newline at end of file