Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 5, 2025

This PR adds automatic build validation for pull requests to prevent website deployment failures by integrating PR validation directly into the existing Zola deployment workflow.

Problem

Currently, PRs are not validated to ensure the website will render correctly, which can result in deployment failures when changes are merged to the main branch.

Solution

Enhanced the existing zola-deploy.yml workflow to handle both PR validation and production deployment:

  • Triggers on pull requests: Added pull_request trigger targeting the main branch for validation
  • Conditional deployment: Uses if: github.event_name != 'pull_request' to skip deployment steps for PRs
  • Smart checkout: Automatically checks out PR branch for pull requests or main branch for deployments
  • Unified build logic: Both PR validation and deployment use identical build processes

Benefits

  • Prevents deployment failures: Catches build issues before they reach production
  • Immediate feedback: Contributors get build validation results directly in their PRs
  • Consistent validation: Uses identical build logic as production deployment
  • Reduced maintenance: Single workflow file eliminates code duplication
  • Minimal implementation: Enhanced existing workflow instead of adding separate files

The workflow validates:

  • TOML configuration syntax errors
  • Missing or broken content files
  • Template rendering problems
  • Sass compilation issues
  • Any other build-time errors

This ensures that only PRs with valid, buildable changes can be merged, significantly reducing the risk of deployment failures while maintaining a clean, consolidated workflow structure.

Fixes #324.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] The zola-deploy script should run automatically on all PRs Add automatic PR validation workflow for Zola build Aug 5, 2025
@Copilot Copilot AI requested a review from madolson August 5, 2025 19:24
Copilot finished work on behalf of madolson August 5, 2025 19:24
@madolson
Copy link
Member

madolson commented Aug 5, 2025

Can you merge this workflow with deploy-zola.yaml

Copy link
Contributor Author

Copilot AI commented Aug 5, 2025

Can you merge this workflow with deploy-zola.yaml

Merged the PR validation workflow into the existing zola-deploy.yml workflow as requested. The consolidated workflow now handles both PR validation and deployment using conditional logic:

  • PR validation: Triggers on pull_request to main, builds only (no deployment)
  • Deployment: Triggers on push to main, builds + deploys to GitHub Pages

This eliminates code duplication while maintaining identical build logic for both scenarios. Commit: 3f05b96

@Copilot Copilot AI changed the title Add automatic PR validation workflow for Zola build Add automatic PR validation workflow integrated with Zola deployment Aug 5, 2025
Copilot finished work on behalf of madolson August 5, 2025 19:30
@madolson madolson marked this pull request as ready for review August 5, 2025 20:00
@madolson madolson requested a review from stockholmux as a code owner August 5, 2025 20:00
@madolson madolson merged commit 9f230f0 into main Aug 5, 2025
3 checks passed
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.

The zola-deploy script should run automatically on all PRs
2 participants