Azure DevOps Pipeline task to clean up workspaces that are deployed to Codesphere for a PullRequest.
Example pipeline config
# Either trigger on every main merge
trigger:
branches:
include:
- 'main'
# let this run regularly.
schedules:
- cron: '0 0 * * *'
displayName: Daily midnight clanup
branches:
include:
- main
pool:
name: Azure Pipelines
vmImage: ubuntu-latest
variables:
- group: my-vars
steps:
- task: codesphere-pr-cleanup@0
inputs:
codesphereEmail: $(cs_username)
codespherePassword: $(cs_password)
team: My Team
Required Permissions for the pipeline:
The pipeline user requires the PullRequestContribute permissions in order to comment in the PullRequest.
Navigate to Project Settings >> Repositories >> select Security tab >> Type Project Collection Build Service (organizationName) in the search box >> check if the Contribute to pull requests permission is set to Allow.