Skip to content

fix: ensure GitHub Pages build_type is reset to workflow on every deploy run - #2

Merged
vmitsaras merged 2 commits into
mainfrom
copilot/fix-deploy-job-failure
Jul 6, 2026
Merged

fix: ensure GitHub Pages build_type is reset to workflow on every deploy run#2
vmitsaras merged 2 commits into
mainfrom
copilot/fix-deploy-job-failure

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

actions/configure-pages@v6 with enablement: true only creates a new Pages site if one doesn't exist — if a site already exists with a non-workflow build type it silently accepts the wrong config, causing deploy-pages to immediately return deployment_failed.

Changes

  • .github/workflows/pages.yml — replace configure-pages@v6 with a direct gh api call that explicitly sets build_type: workflow via PUT (update existing site) with a POST fallback (create if absent):

    - name: Configure GitHub Pages
      env:
        GH_TOKEN: ${{ github.token }}
      run: |
        gh api "repos/${{ github.repository }}/pages" \
          --method PUT \
          --field build_type=workflow \
        || gh api "repos/${{ github.repository }}/pages" \
          --method POST \
          --field build_type=workflow
  • permissions — add administration: write so GITHUB_TOKEN has authority to call the Pages update endpoint.

Replace actions/configure-pages@v6 with a direct GitHub API call that
uses PUT to update an existing Pages site's build_type to 'workflow',
falling back to POST to create the site if it does not exist.

The previous configure-pages action would silently accept an existing
Pages site regardless of its build_type, meaning a site misconfigured
for branch-based deployment would cause deploy-pages to fail with
'Deployment failed, try again later.' Also add administration:write
permission so the GITHUB_TOKEN can update repository Pages settings.
Copilot AI changed the title [WIP] Fix failing GitHub Actions job deploy fix: ensure GitHub Pages build_type is reset to workflow on every deploy run Jul 6, 2026
Copilot AI requested a review from vmitsaras July 6, 2026 12:56
@vmitsaras
vmitsaras marked this pull request as ready for review July 6, 2026 13:04
@vmitsaras
vmitsaras merged commit 72908fd into main Jul 6, 2026
@vmitsaras
vmitsaras deleted the copilot/fix-deploy-job-failure branch July 6, 2026 13:04
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