In an Azure DevOps pipeline, you can use the <ProjectName> Build Service
Service Account to checkout the repository and write changes back to the repository.
To do so there are two steps:
Checkout the code but persist the credentials
- checkout: self
persistCredentials: true
clean: true
Then either on the main
branch or the repository level, in the Security
Tab set the Contribute
permission to Allow
for <ProjectName> Build Service