Skip to content

Stop Pages previews overwriting the production site - #228

Merged
Dan Marshall (danmarshall) merged 1 commit into
mainfrom
fix/pages-preview-production-overwrite
Nov 11, 2026
Merged

Dan Marshall (danmarshall) merged 1 commit into
mainfrom
fix/pages-preview-production-overwrite

Conversation

@danmarshall

Copy link
Copy Markdown
Collaborator

Description

Stop the PR preview workflow from overwriting the production GitHub Pages site with the repository root.

Related Issues

No linked issue. Incorrect production deployment: https://github.com/microsoft/chartifact/actions/runs/43089703168

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • ♻️ Code refactoring (no functional changes)
  • 🎨 Style/formatting changes
  • 🧪 Test additions or updates
  • 🔧 Build/tooling changes

Changes Made

  • Trigger the preview artifact workflow only on pull requests, not pushes to main.
  • Remove production deployment and the production environment association.
  • Reduce Pages permissions to read and remove the unused OIDC permission. Keep the existing preview artifact upload and PR comment.

Testing

  • I have tested these changes locally
  • All existing tests pass
  • I have added new tests (if applicable)
  • I have manually verified the changes work as expected

Test Details

  • git diff --check — passed.
  • Workflow YAML parsing and assertions — passed with this exact command:
node --input-type=module -e "import fs from 'node:fs'; import yaml from 'js-yaml'; import assert from 'node:assert/strict'; const w=yaml.load(fs.readFileSync('.github/workflows/pages-preview.yml','utf8')); assert.deepEqual(Object.keys(w.on),['pull_request']); assert.equal(w.jobs.deploy.permissions.pages,'read'); assert.ok(!w.jobs.deploy.environment); assert.ok(!w.jobs.deploy.steps.some(s=>s.uses?.startsWith('actions/deploy-pages@'))); console.log('Pages workflow checks passed');"
  • Confirmed production returned 404 while the accidentally nested /chartifact/docs/ returned 200.
  • No local build run: this changes only workflow triggers, deployment, and permissions. Cloud validation and the production rebuild are pending.

Screenshots/Recordings

Not applicable.

Documentation

  • I have updated the documentation (if applicable)
  • I have updated examples (if applicable)
  • Code comments are clear and helpful

Checklist

  • My code follows the project's coding guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have checked for security issues in my changes
  • I have not committed secrets, credentials, or sensitive data
  • I have kept changes minimal and focused on the issue being addressed
  • I have updated CONTRIBUTING.md if I added new development workflows

Additional Context

Pages is configured to build main/docs using Jekyll. The preview workflow uploaded path: . and deployed it on pushes to main, racing that publishing mechanism and replacing the site with unprocessed repository contents. Queued preview deployments have been cancelled and a rebuild from the configured Pages source requested. Merge this fix to prevent recurrence.

For Maintainers

  • Code review completed
  • All CI checks passing
  • Documentation reviewed
  • Ready to merge

Restrict preview artifacts to pull requests and remove production deployment. Leave publishing to the configured main/docs Pages source.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: eca2adda-c35b-4e8c-9fdb-5da48c2ae88e
@danmarshall
Dan Marshall (danmarshall) merged commit 7de6a60 into main Nov 11, 2026
6 checks passed
@danmarshall
Dan Marshall (danmarshall) deleted the fix/pages-preview-production-overwrite branch November 11, 2026 20:23
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.

1 participant