From f3802439d05f5f809d41de87e3ff773a379b4603 Mon Sep 17 00:00:00 2001 From: Trent Blackburn Date: Fri, 12 Jun 2026 10:12:45 -0400 Subject: [PATCH] ci: delete redundant bot-branch-delete workflow; make cleanup explicit Mirror the change from SrrDBAutomationToolkit#29: - Add --delete-branch to both gh pr merge calls in auto-merge-bots.yml so bot PR branches are deleted explicitly at merge time. - Remove the redundant delete-merged-bot-branches.yml on-close workflow, which raced with merge-time cleanup and only ever failed with "Reference does not exist". Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/auto-merge-bots.yml | 4 ++-- .../workflows/delete-merged-bot-branches.yml | 22 ------------------- 2 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/delete-merged-bot-branches.yml diff --git a/.github/workflows/auto-merge-bots.yml b/.github/workflows/auto-merge-bots.yml index c404ed5..6426435 100644 --- a/.github/workflows/auto-merge-bots.yml +++ b/.github/workflows/auto-merge-bots.yml @@ -19,7 +19,7 @@ jobs: - name: Auto-merge minor and patch updates if: steps.meta.outputs.update-type != 'version-update:semver-major' - run: gh pr merge --auto --squash "$PR_URL" + run: gh pr merge --auto --squash --delete-branch "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Auto-merge pre-commit.ci updates - run: gh pr merge --auto --squash "$PR_URL" + run: gh pr merge --auto --squash --delete-branch "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/delete-merged-bot-branches.yml b/.github/workflows/delete-merged-bot-branches.yml deleted file mode 100644 index 18fc4d2..0000000 --- a/.github/workflows/delete-merged-bot-branches.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Delete merged bot branches - -on: - pull_request: - types: [closed] - -permissions: - contents: write - -jobs: - delete-branch: - if: > - github.event.pull_request.merged == true && - (github.event.pull_request.user.login == 'pre-commit-ci[bot]' || - github.event.pull_request.user.login == 'dependabot[bot]') - runs-on: ubuntu-latest - steps: - - name: Delete head branch - run: gh api -X DELETE "repos/${GITHUB_REPOSITORY}/git/refs/heads/${HEAD_REF}" - env: - HEAD_REF: ${{ github.event.pull_request.head.ref }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}