Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 23, 2025

Problem

The GitHub Pages deployment workflow was triggering deployments for both commits to main and for pull requests. This meant that PRs were deploying to the production GitHub Pages site, which is unnecessary and could cause issues with incomplete or experimental code being published.

Solution

Added a conditional check to the deploy job to ensure it only runs for push events to the main branch:

deploy:
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'

Behavior

Before:

  • ❌ PRs triggered both build and deployment
  • ❌ Every PR update deployed to GitHub Pages

After:

  • ✅ PRs trigger build job only (CI validation)
  • ✅ Deployment only occurs on commits pushed to main
  • ✅ Merged PRs trigger deployment (since they become commits on main)

Testing

  • YAML syntax validated
  • Build and lint tests pass
  • CodeQL security scan completed with no issues
  • Minimal change: only 1 line added to workflow file

This change ensures that GitHub Pages deployments only happen for production-ready code on the main branch, while maintaining CI validation for all pull requests.

Original prompt

Update the github pages deployment that only new commits to main trigger a deployment. Deployment should be skippep for PRs


💡 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 changed the title [WIP] Update GitHub Pages deployment configuration Fix GitHub Pages deployment to only run on push to main, skip PRs Oct 23, 2025
Copilot AI requested a review from balloob October 23, 2025 14:53
Copilot finished work on behalf of balloob October 23, 2025 14:53
@balloob balloob marked this pull request as ready for review October 23, 2025 15:38
@balloob balloob merged commit 59798d6 into main Oct 23, 2025
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.

2 participants