Skip to content

Changes by create-pull-request action #11

Changes by create-pull-request action

Changes by create-pull-request action #11

Workflow file for this run

name: PR Close Event
on:
pull_request:
types:
- closed
permissions: write-all
jobs:
delete-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Delete branch
run: |
pr_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
base_ref=$(jq --raw-output .pull_request.base.ref "$GITHUB_EVENT_PATH")
head_ref=$(jq --raw-output .pull_request.head.ref "$GITHUB_EVENT_PATH")
git push origin --delete "$head_ref"
if [ "$merged" = "true" ]; then
echo "Deleting branch $head_ref"
else
echo "PR is not merged. Branch will not be deleted."
fi