2021-09-10 14:48:48 -04:00
|
|
|
name: Clean Preview
|
|
|
|
|
|
|
|
#! Safety:
|
2021-09-13 23:54:39 -04:00
|
|
|
#! this workflow should not execute any untrusted input at all
|
|
|
|
#! see the docs on `pull_request_target` for more
|
2021-09-10 14:48:48 -04:00
|
|
|
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
|
2021-09-11 10:12:14 -04:00
|
|
|
single-commit: true
|
2021-09-10 14:48:48 -04:00
|
|
|
|
|
|
|
- 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
|