Open
Description
After PR is merged or closed, we can trigger a task that will remove all matching source preview branches.
To detect matching branches, build_preview_generated_code
should include some identifier related to PR in their names.
Something like branch_name=generated-sources/docs-update-${{ github.event.number }}-${{ github.run_number }}
https://stackoverflow.com/questions/59077079/how-to-get-pull-request-number-within-github-actions-workflow
and removing them:
branch_prefix="generated-sources/docs-update-${{ github.event.number }}"
for branch in $(git branch -r | grep "$branch_prefix"); do
branch_name=${branch#origin/}
git push origin --delete "$branch_name"
done