Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/cleanup-auto-update-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Clean up merged auto-update branches

on:
pull_request:
types: [closed]

# Deleting a branch updates a Git reference in this repository.
permissions:
contents: write

jobs:
delete-branch:
# Only touch merged automation PRs whose branch belongs to this repository.
# This excludes closed-but-unmerged PRs, forks, and ordinary feature branches.
if: >-
github.event.pull_request.merged == true &&
github.event.pull_request.head.repo.full_name == github.repository &&
startsWith(github.event.pull_request.head.ref, 'auto/update-')
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Delete merged update branch
env:
GH_TOKEN: ${{ github.token }}
BRANCH: ${{ github.event.pull_request.head.ref }}
REPOSITORY: ${{ github.repository }}
run: |
gh api \
--method DELETE \
"repos/${REPOSITORY}/git/refs/heads/${BRANCH}"
Loading