Untitled
unknown
plain_text
2 years ago
943 B
4
Indexable
trigger: branches: include: - '*' pr: branches: include: - '*' pool: vmImage: 'windows-latest' steps: - checkout: self - script: | # Ensure you are on the target branch git checkout test # Merge changes from the source branch git merge $(System.PullRequest.SourceBranch) # Push changes to the repository git push origin test displayName: 'Merge changes to test' - powershell: | $sourceBranch = '$(System.PullRequest.SourceBranch)' $url = "$(System.CollectionUri)$(System.TeamProject)/_apis/git/repositories/$(Build.Repository.ID)/refs/heads/$($sourceBranch)?api-version=6.0" $token = "YOUR_PERSONAL_ACCESS_TOKEN_HERE" $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($token)")) Invoke-RestMethod -Uri $url -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method Delete displayName: 'Delete source branch after merge'
Editor is loading...