Changes by create-pull-request action #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |