File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535
3636 $page = 1
3737 $release_list = @()
38+ $tagsToDelete = @()
3839
3940 Do {
4041
@@ -49,11 +50,28 @@ jobs:
4950 $release_list | ForEach-Object {
5051 if ($_.tag_name -like "Pre-Release-*" -and $_.prerelease) {
5152 "Deleting pre-release $($_.tag_name)" | Write-Output
53+ # Store tag name for later deletion
54+ $tagsToDelete += $_.tag_name
55+ # Delete the release
5256 Invoke-RestMethod -Method Delete -Uri $_.url -Headers $gh_headers
5357 }
5458 }
5559
5660 $page += 1
5761 } While ($release_list.count -gt 0)
5862
63+ # Delete the git tags for the pre-releases
64+ $tagsToDelete | ForEach-Object {
65+ $tagName = $_
66+ "Deleting git tag $tagName" | Write-Output
67+ $tagUrl = "https://api.github.com/repos/$repo/git/refs/tags/$tagName"
68+ try {
69+ Invoke-RestMethod -Method Delete -Uri $tagUrl -Headers $gh_headers
70+ "Successfully deleted tag $tagName" | Write-Output
71+ }
72+ catch {
73+ "Warning: Could not delete tag $tagName - $($_.Exception.Message)" | Write-Output
74+ }
75+ }
76+
5977 # Manually doing promote packages to release on azure artifacts
You can’t perform that action at this time.
0 commit comments