Skip to content

Commit

Permalink
delete all previews on merge or close
Browse files Browse the repository at this point in the history
  • Loading branch information
ssolson committed Feb 4, 2025
1 parent 2ef83cf commit 56c50a9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cleanup-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Cleanup PR Preview

on:
pull_request:
types: [closed]

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GH_PAGES_DEPLOY_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Delete All Previews
run: |
git clone --single-branch --branch gh-pages [email protected]:MHKiT-Software/MHKiT.git gh-pages
cd gh-pages
rm -rf pr-previews/
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add -A
git commit -m "Remove all previews after merging PR #${{ github.event.pull_request.number }}" || echo "No cleanup needed"
git push

0 comments on commit 56c50a9

Please sign in to comment.