File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,6 +215,26 @@ step "publish-winget-update-pr" {
215215 action_type = "Octopus.Script"
216216 properties = {
217217 Octopus.Action.Script.ScriptBody = <<-EOT
218+ #Headers
219+ $headers = @{
220+ 'Accept' = "application/vnd.github+json";
221+ 'X-GitHub-Api-Version' = "2022-11-28";
222+ }
223+ try {
224+
225+ # Delete the fork of the winget-pkgs repo using the bot's token
226+ $response = Invoke-WebRequest -Method "DELETE" -Uri "https://api.github.com/repos/team-integrations-fnm-bot/winget-pkgs" -Authentication "Bearer" -Token $OctopusParameters["Publish:Winget:GitHubPAT"] -Headers $headers
227+ $statusCode = $Response.StatusCode
228+ }
229+ catch {
230+ $statusCode = $_.Exception.Response.StatusCode.value__
231+ }
232+
233+ if (!($statusCode -ge 200 -and $statusCode -le 299 )) {
234+ Write-Warning "Failed to delete fork repo 'team-integrations-fnm-bot/winget-pkgs'. If this fork is too far behind its source, winget-create may fail."
235+ }
236+
237+
218238 # Install winget-create
219239 Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
220240
You can’t perform that action at this time.
0 commit comments