Skip to content

Commit

Permalink
Use github API to delete branches
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Oct 13, 2020
1 parent e7f4560 commit 66a2e8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions eng/common/scripts/Delete-RemoteBranches.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@ foreach ($branch in $branches)
exit 1
}

"bvranch $branch"
"PR COunt $($pullRequests.Count)"


if ($pullRequests.Count -eq 0)
{
LogDebug "Branch [ $branchName ] in repo [ $RepoName ] has no associated Pull Request. Deleting Branch"
try{
Delete-References -RepoOwner $RepoOwner -RepoName $RepoName -Ref ($branch.Remove(0,5))
Delete-References -RepoOwner $RepoOwner -RepoName $RepoName -Ref ($branch.Remove(0,5)) -AuthToken $AuthToken
}
catch {
LogError "Delete-References failed with exception:`n$_"
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/tools-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
workingDirectory: $(System.DefaultWorkingDirectory)
filePath: $(System.DefaultWorkingDirectory)/eng/common/scripts/Delete-RemoteBranches.ps1
arguments: >
-RepoOwner "Azure"
-RepoName ${{ repo }}
-BranchPrefix "sync-eng/common-"
-WorkingDirectory $(System.DefaultWorkingDirectory)
-AuthToken $(azuresdk-github-pat)

0 comments on commit 66a2e8b

Please sign in to comment.