Skip to content

Post event

Post event #117

Workflow file for this run

name: Preview Cleanup
on:
pull_request:
types: [closed]
# Ensure that only one workflow which pushes to the `main` branch is running at a time.
# Note: this is the same concurrency group as the `Deploy.yml` workflow.
concurrency:
group: pushing-website
cancel-in-progress: false
jobs:
preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Delete preview and history + push changes
run: |
if [ -d "${preview_dir}" ]; then
git config user.name "Franklin.jl"
git config user.email "[email protected]"
git rm -rf "${preview_dir}"
git commit -m "delete preview"
git branch main-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin main-new:main
fi
env:
preview_dir: previews/PR${{ github.event.number }}