Delete staging and head branches on PR close

This commit is contained in:
Robert Thorpe II
2022-03-01 17:35:04 +01:00
committed by GitHub
parent 86dd87cf37
commit caa010b06d
@@ -1,4 +1,4 @@
name: Delete PR staging branch
name: Delete PR staging and head branches
on:
pull_request_target:
@@ -9,14 +9,16 @@ on:
workflow_dispatch:
jobs:
delete-staging-branch:
delete-staging-and-head-branches:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: delete staging branch
- name: Delete staging and head branches
env:
STAGING_BRANCH: ${{ github.event.pull_request.base.ref }}
HEAD_BRANCH: ${{ github.event.pull_request.head.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -xeo pipefail
git push origin --delete $STAGING_BRANCH
git push origin --delete --force $STAGING_BRANCH
git push origin --delete --force $HEAD_BRANCH