You've already forked devops-pipeline-template
Add workflows for closing and deleting branches on PR merge
This commit is contained in:
@@ -38,15 +38,3 @@ jobs:
|
||||
echo "Branch created: $BRANCH_NAME"
|
||||
fi
|
||||
|
||||
- name: Delete branch on issue close
|
||||
if: github.event.action == 'closed'
|
||||
run: |
|
||||
ISSUE_NUMBER=${{ github.event.issue.number }}
|
||||
|
||||
echo "Searching branches for issue-${ISSUE_NUMBER}-*"
|
||||
|
||||
for branch in $(git ls-remote --heads origin | grep "refs/heads/issue-${ISSUE_NUMBER}-" | awk '{print $2}' | sed 's|refs/heads/||'); do
|
||||
echo "Deleting branch: $branch"
|
||||
git push origin --delete "$branch" || echo "Failed to delete $branch"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user