-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
delete all previews on merge or close
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
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 |