Skip to content

Commit

Permalink
Merge pull request gooddata#454 from hkad98/trivial
Browse files Browse the repository at this point in the history
TRIVIAL: delete branch only if it exists

Reviewed-by: https://github.com/Mara3l
  • Loading branch information
gdgate authored Nov 23, 2023
2 parents ae8f951 + 92ed9de commit 3de240d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/actions/merge/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ runs:
shell: bash
id: push
- name: Create the promote/backmerge PR
id: pr
run: |
gh pr create \
--title "[bot] Merge ${{ inputs.source }}/${{ steps.push.outputs.short }} into ${{ inputs.target }}" \
Expand All @@ -71,7 +70,12 @@ runs:
GH_TOKEN: ${{ inputs.token_pr }}
- name: Delete the source branch
if: ${{ inputs.merge == 'true' && inputs.delete_branch == 'true' }}
run: git push origin -d ${{ steps.push.outputs.branch }}
run: |
if git show-ref --verify --quiet refs/heads/${{ steps.push.outputs.branch }}; then
git branch -d ${{ steps.push.outputs.branch }}
else
echo "Nothing to delete. Branch ${{ steps.push.outputs.branch }} does not exist."
fi
shell: bash
env:
GH_TOKEN: ${{ inputs.token_pr }}

0 comments on commit 3de240d

Please sign in to comment.