Skip to content

Bump form-data from 4.0.3 to 4.0.4 #21

Bump form-data from 4.0.3 to 4.0.4

Bump form-data from 4.0.3 to 4.0.4 #21

name: Cleanup Dev
on:
pull_request:
types: [closed]
jobs:
cleanup-ui-pr-preview:
permissions:
contents: write
id-token: 'write'
issues: write
runs-on: ubuntu-latest
steps:
- name: Check out gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
fetch-depth: 1
- name: Check if preview directory exists
id: check-preview
run: |
if [ -d "ui/pr/${{ github.event.pull_request.number }}" ]; then
echo "preview_exists=true" >> $GITHUB_OUTPUT
echo "Preview directory exists for PR #${{ github.event.pull_request.number }}"
else
echo "preview_exists=false" >> $GITHUB_OUTPUT
echo "No preview directory found for PR #${{ github.event.pull_request.number }}"
fi
- name: Create an empty directory for cleanup
if: steps.check-preview.outputs.preview_exists == 'true'
run: mkdir -p empty
- name: Remove GitHub Pages Build
if: steps.check-preview.outputs.preview_exists == 'true'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./empty
destination_dir: ui/pr/${{ github.event.pull_request.number }}
keep_files: false
user_name: ${{ github.actor }}
user_email: ${{ github.actor }}@users.noreply.github.com
publish_branch: gh-pages
commit_message: 'chore: Clean up preview for PR #${{ github.event.pull_request.number }}'
- name: Log Cleanup Completion
run: echo "Cleanup completed for PR \#${{ github.event.pull_request.number }}"
update-preview-comment:
needs: [cleanup-ui-pr-preview]
name: Update PR Comment
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
steps:
- name: Update PR comment to reflect cleanup
uses: peter-evans/find-comment@v2
id: find-comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- pr-preview-comment -->'
- name: Update PR comment to reflect cleanup
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
<!-- pr-preview-comment -->
🧹 The live preview for this PR has been removed.
- name: Log comment update status
run: |
if [ "${{ steps.find-comment.outputs.comment-id }}" != "" ]; then
echo "Updated existing preview comment"
else
echo "No preview comment found to update"
fi