add helper methods #209
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: Delete gh-pages preview after PR merge | |
on: | |
pull_request: | |
types: [ closed ] | |
jobs: | |
delete_gh-pages_preview: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: check if branch still exists | |
id: ls-remote | |
run: | | |
out=$(git ls-remote --heads origin gh-pages-${{ github.event.pull_request.head.ref }}) | |
echo "::set-output name=out::$out" | |
- name: delete gh-pages preview branch gh-pages-${{ github.event.pull_request.head.ref }} | |
if: steps.ls-remote.outputs.out | |
run: git push origin --delete gh-pages-${{ github.event.pull_request.head.ref }} |