Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/pr-preview-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'cleanup PR preview'

on:
pull_request_target:
types: [closed]

jobs:
cleanup:
name: 'delete PR preview'
runs-on: ubuntu-22.04

permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
ref: gh-pages

- name: Delete PR preview directory
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would also need to be queued to prevent collisions with publishing as in #3821

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
run: |
if [ ! -d "pr/$PR_NUMBER" ]; then
echo "No preview directory found for PR $PR_NUMBER"
exit 0
fi

git config user.email "bot@tc39"
git config user.name "Bot"
git rm -rf "pr/$PR_NUMBER"
git commit --message "Remove gh-pages preview for PR $PR_NUMBER"
git push origin gh-pages
Loading