79109110

Date: 2024-10-21 08:09:23
Score: 0.5
Natty:
Report link

To add to the above answers - there's no need to create a PAT if your pipeline build agent has sufficient permissions.

- checkout: self
    persistCredentials: true
- bash: |
      git config --global user.email "[email protected]"
      git config --global user.name "Azure DevOps Pipeline"
    name: GitConfig
- pwsh: |
   git checkout -b MyBranch main
   New-Item test.txt //add something new
   git add test.txt
   git commit -m "Test commit"
   git push origin "HEAD:MyBranch"
   az repos pr create <INSERT ARGS HERE>
 env:
   AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

The code required comes from the following sources

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Christopher Dunderdale