Post event #117
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: 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 }} |