name: Clean Preview #! Safety: #! this workflow should not execute any code at all #! see githubs docs on pull_request_target for more on: pull_request_target: types: [unlabeled] jobs: clean: runs-on: ubuntu-latest if: github.event.label.name == 'use-preview' steps: - uses: actions/checkout@v2 with: ref: build-previews persist-credentials: false - name: clean previews run: 'rm -rf "./refs/pull/${{ github.event.pull_request.number }}"' - name: publish cleaned previews uses: JamesIves/github-pages-deploy-action@4.1.5 with: folder: . branch: build-previews - name: send comment uses: marocchino/sticky-pull-request-comment@v2 with: header: Preview environment message: | ## Preview environment There is no longer a preview enviroment for this pull request due to the `use-preview` label being removed