Skip to content

Auto-enable Pages on first deploy#1445

Closed
bmehta001 wants to merge 1 commit into
microsoft:mainfrom
bmehta001:bhamehta/pages-enablement
Closed

Auto-enable Pages on first deploy#1445
bmehta001 wants to merge 1 commit into
microsoft:mainfrom
bmehta001:bhamehta/pages-enablement

Conversation

@bmehta001
Copy link
Copy Markdown
Contributor

Summary

  • Pass enablement: true to actions/configure-pages@v5 so the Deploy documentation to GitHub Pages workflow provisions the Pages site on first run.

Why

The post-merge deploy job has been failing on every push to main with::

Error: Get Pages site failed. Please verify that the repository has Pages
enabled and configured to build using GitHub Actions, or consider exploring
the `enablement` parameter for this action.
Error: Not Found - https://docs.github.com/rest/pages/pages#get-a-apiname-pages-site

gh api repos/microsoft/cpp_client_telemetry/pages returns 404, which means GitHub Pages has never been provisioned for this repository. actions/configure-pages accepts an enablement parameter that asks the action to create the Pages site on first run; the workflow already grants the pages: write and id-token: write permissions it needs to do so.

Fallback

If the org-level GITHUB_TOKEN restrictions still prevent automatic provisioning, a repository admin only needs to flip Settings -> Pages -> Build and deployment -> Source to GitHub Actions once; subsequent deploys will then succeed without the failure.

Validation

  • YAML parsed cleanly with python -c "import yaml; yaml.safe_load(open(...))"
  • Diff is a two-line addition under the existing actions/configure-pages@v5 step

The GitHub Pages site has never been provisioned for this repository,
so the post-merge deploy job in deploy-docs-pages.yml fails when
actions/configure-pages@v5 looks up the site and gets a 404 (HTTP Not
Found from the Pages API).

Pass `enablement: true` to actions/configure-pages so the action
provisions the Pages site on first run instead of erroring out. The
workflow already grants the `pages: write` and `id-token: write`
permissions that the action needs to do this.

If the org-level GITHUB_TOKEN restrictions still prevent automatic
enablement, a repository admin only needs to flip Settings -> Pages ->
Build and deployment -> Source to `GitHub Actions` once; subsequent
deploys will then succeed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 requested a review from a team as a code owner May 22, 2026 17:40
@bmehta001 bmehta001 requested a review from Copilot May 26, 2026 23:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub Pages deploy workflow to automatically provision/enable the repository’s Pages site on the first successful deployment, addressing current Get Pages site failed / 404 failures when Pages hasn’t been configured yet.

Changes:

  • Pass enablement: true to actions/configure-pages@v5 in the deploy job so the action can auto-enable Pages on first run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/deploy-docs-pages.yml
@bmehta001 bmehta001 closed this May 29, 2026
@bmehta001 bmehta001 self-assigned this May 29, 2026
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