revite/.github/workflows/preview_cleanup.yml

40 lines
1.3 KiB
YAML
Raw Normal View History

2021-09-10 14:48:48 -04:00
name: Clean Preview
#! Safety:
#! 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'
2021-09-14 00:03:58 -04:00
env:
BASE: refs/pull/${{ github.event.pull_request.number }}
2021-09-10 14:48:48 -04:00
steps:
- uses: actions/checkout@v2
with:
ref: build-previews
persist-credentials: false
- name: clean previews
2021-09-14 00:03:58 -04:00
run: rm -rf "$BASE"
2021-09-10 14:48:48 -04:00
- name: publish cleaned previews
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
folder: .
branch: build-previews
2021-09-16 16:38:18 -04:00
commit-message: "Cleaning up build result for #${{ github.event.pull_request.number }}"
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