azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az repos pr create --delete-source-branch

Open erikrok opened this issue 2 years ago • 5 comments

Describe the bug

In a CI/CD workflow in Azure Releases, I automatically create a PR after a stage. When this PR is approved and completed, I want it to be automatically be deleted, and set the flag --delete-source-branch true. Documentation explains: Delete the source branch after the pull request has been completed and merged into the target branch.

The PR get created successfully, but the branch is not deleted when I complete the PR.

Note that this PR is created as the user Project Collection Build Service ({OrgName}), using the: environment token in Azure Releases: AZURE_DEVOPS_EXT_PAT and $(System.AccessToken)

Related command

az repos pr create \
   --project ProjectName \
   --organization https://dev.azure.com/Project/ \
   --repository RepositoryName \
   --delete-source-branch true \
   --source-branch $BRANCH_NAME \
   --target-branch main \
   --title "Title $BUILDID, release $RELEASENAME, $(date +%Y%m%d%H%M)" \
   --reviewers "[email protected]"
   --description "Deployed $(date -I)" "ref: $BUILD_COMMIT"

Errors

no errors

Issue script & Debug output

cli.knack.cli: Command arguments: ['repos', 'pr', 'create', '--project', 'Project', '--organization', 'https://dev.azure.com/Organization/', '--repository', 'ProjectBackend', '--delete-source-branch', 'true', '--source-branch', 'testing_pr_loc', '--target-branch', 'testing_pr', '--title', 'TESTING', '--reviewers', '[email protected]', '--description', '- Deployed Synapse to prod 2023-09-29', 'testing', '--debug']

Expected behavior

I expect that the branch will be deleted after the PR has been completed, as documentation says.

Environment Summary

bash script, running in a Bash@3 - Bash v3 task

Additional context

No response

erikrok avatar Sep 29 '23 09:09 erikrok

Thank you for opening this issue, we will look into it.

yonzhan avatar Sep 29 '23 09:09 yonzhan

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @v-anvashist, @V-hmusukula.

We are also impacted by this.

sb1975 avatar Oct 16 '23 20:10 sb1975

+1 impacted :(

ThisIsLNo avatar Nov 27 '23 15:11 ThisIsLNo

Hi all, I also notice the same issue with Azure DevOps UI (I think that the UI use APIs too). The source branch is never deleted.

FFraterBizeta avatar Mar 01 '24 12:03 FFraterBizeta