Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 30, 2025

This PR implements a GitHub Pages-based static preview system that automatically generates and deploys lightweight previews for pull requests, making it easier to review UI and template changes.

What's Added

New Workflow: .github/workflows/github-pages-preview.yml

  • Automatically triggers on PRs affecting templates, static files, explanations, or Java code
  • Generates static HTML previews with all CSS, JavaScript, and assets preserved
  • Deploys each PR to a unique URL: https://owasp.github.io/wrongsecrets/pr-{number}/
  • Automatically cleans up when PRs are closed or merged

Enhanced PR Review Experience:

  • Comments on PRs with direct preview links
  • Shows metadata about changed files and commit information
  • Provides clear guidance on preview limitations vs. full Docker testing
  • Integrates seamlessly with existing Docker-based preview system

How It Works

  1. PR Detection: Workflow triggers when relevant files are modified
  2. Build Verification: Compiles Spring Boot application to ensure changes don't break the build
  3. Static Generation: Copies all static assets (CSS, JS, images, favicons) to PR-specific directory
  4. Page Creation: Generates informative landing page with PR context and changed files list
  5. Deployment: Pushes to GitHub Pages with automatic URL generation
  6. Notification: Comments on PR with preview link and usage instructions
  7. Cleanup: Removes preview content when PR is closed/merged

Benefits

  • 🚀 Fast Reviews: Immediate static preview for UI changes without waiting for Docker builds
  • 🌐 Shareable: Easy-to-share URLs for stakeholders and reviewers
  • 💰 Zero Cost: Uses GitHub's infrastructure, no external dependencies
  • 🔄 Auto-updating: Refreshes automatically on new commits
  • 🧹 Self-cleaning: No manual maintenance required
  • 📱 Responsive: Preserves all existing styling and responsive design

Example Usage

When a PR modifies src/main/resources/templates/welcome.html or src/main/resources/static/css/style.css, the workflow automatically:

  1. Creates a preview at https://owasp.github.io/wrongsecrets/pr-123/
  2. Comments on the PR with the preview link
  3. Shows what files were changed and their impact
  4. Provides fallback links to Docker preview for full functionality testing

Documentation Updates

Updated docs/PR_PREVIEW_SETUP.md to include the new GitHub Pages preview as the primary option for UI/static content reviews, with clear setup instructions and integration guidance.

This complements the existing Docker-based preview system - use GitHub Pages for quick UI reviews and Docker for comprehensive functionality testing.

Fixes #2126.


💡 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.

Copilot AI and others added 3 commits July 30, 2025 07:58
Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
Copilot AI changed the title [WIP] Have a static preview of the app on GitHub pages, with a new preview per pr Add GitHub Pages static preview system for PR reviews Jul 30, 2025
Copilot AI requested a review from commjoen July 30, 2025 08:04
@commjoen
Copy link
Collaborator

@copilot can you check the precommit errors at https://github.com/OWASP/wrongsecrets/actions/runs/16616906344/job/47029184000?pr=2127 please?

Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 30, 2025

@copilot can you check the precommit errors at https://github.com/OWASP/wrongsecrets/actions/runs/16616906344/job/47029184000?pr=2127 please?

Fixed the pre-commit errors. The issues were trailing whitespace and a missing newline at the end of the GitHub Pages workflow file. All formatting issues have been resolved in commit 35f391f.

@commjoen commjoen marked this pull request as ready for review July 30, 2025 21:58
@commjoen commjoen requested a review from bendehaan as a code owner July 30, 2025 21:58
@commjoen commjoen merged commit ad7f3d9 into master Jul 30, 2025
16 checks passed
@commjoen commjoen deleted the copilot/fix-2126 branch July 30, 2025 21:59
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.

Have a static preview of the app on GitHub pages, with a new preview per pr

2 participants