Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 26, 2025

This PR addresses issue #342 by adding an automated GitHub Actions workflow to clean up DoodleBUGS PR previews when pull requests are closed or merged.

Problem

Currently, when PRs containing DoodleBUGS changes are created, the DoodleBUGSpreview.yml workflow automatically builds and deploys preview sites to DoodleBUGS/pr-previews/{PR_NUMBER} in the gh-pages branch. However, these preview directories (including all their JavaScript, CSS, and asset files) remain indefinitely after PRs are closed, leading to:

  • Accumulation of stale preview directories
  • Unnecessary storage usage
  • Cluttered gh-pages branch with outdated preview assets

Solution

Added a new workflow .github/workflows/DoodleBUGSPreviewCleanup.yml that:

  • Triggers automatically when pull requests are closed (both merged and closed without merging)
  • Removes entire preview directories including all JS, CSS, and asset files using git rm -rf
  • Includes path filtering to only run when DoodleBUGS-related files are changed, improving efficiency
  • Provides error handling with conditional checks and informative logging
  • Uses modern GitHub Actions practices including actions/checkout@v4 and explicit permissions

Key Features

  • Complete cleanup: Removes the entire DoodleBUGS/pr-previews/{PR_NUMBER} directory and all its contents
  • Path consistency: Uses the exact same path structure as the preview deployment workflow
  • Robust error handling: Gracefully handles cases where no preview exists
  • Clear commit messages: Descriptive git commits for tracking cleanup actions
  • Minimal permissions: Only requests the necessary contents: write permission

The workflow follows the same pattern as the existing DocsPreviewCleanup.yml but is specifically tailored for the DoodleBUGS preview structure and includes several improvements like path-based triggering and updated action versions.

This ensures that the gh-pages branch stays clean and only contains active preview sites, while automatically removing all associated assets when PRs are closed.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@yebai yebai marked this pull request as ready for review August 26, 2025 22:27
@yebai yebai requested a review from shravanngoswamii August 26, 2025 22:28
@Copilot Copilot AI changed the title [WIP] Try fix @TuringLang/JuliaBUGS.jl/issues/342 Add DoodleBUGS PR Preview cleanup workflow Aug 26, 2025
Copilot finished work on behalf of yebai August 26, 2025 22:29
@Copilot Copilot AI requested a review from yebai August 26, 2025 22:29
@shravanngoswamii
Copy link
Member

I am changing DoodleBUGS workflows to add more things, so let hold it for now!

@shravanngoswamii shravanngoswamii marked this pull request as draft August 27, 2025 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants