Skip to content

Commit

Permalink
ensure that branch isn't deleted if merge is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansingman committed Nov 5, 2022
1 parent fe39b80 commit 9f108da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ runs:
git checkout $BASE_REF && \
git pull && \
git merge --ff-only origin/$HEAD_REF && \
git push
git push && \
echo "success=1" >> $GITHUB_OUTPUT || \
echo "success=0" >> $GITHUB_OUTPUT
;;
"merge")
echo "Performing merge."
Expand All @@ -100,6 +102,8 @@ runs:
git pull && \
git merge origin/$HEAD_REF && \
git push
echo "success=1" >> $GITHUB_OUTPUT || \
echo "success=0" >> $GITHUB_OUTPUT
;;
*)
echo "Invalid merge type: ${{ inputs.merge_type }}"
Expand All @@ -115,7 +119,7 @@ runs:
shell: bash

# if delete source branch, delete branch
- if: success() && ${{ inputs.delete_branch }} && ${{ steps.merge.conclusion == 'success' }}
- if: success() && ${{ inputs.delete_branch }} && ${{ steps.merge.outputs.success == 1 }}
run: |
echo "Deleting source branch: ${{ github.event.pull_request.head.ref }}"
git push --delete origin ${{ github.event.pull_request.head.ref }}
Expand Down

0 comments on commit 9f108da

Please sign in to comment.