Skip to content

Fix GitHub Pages deploy failure by replacing subtree force-push flow#650

Merged
espresso3389 merged 2 commits into
masterfrom
copilot/fix-deploy-job-failure
May 27, 2026
Merged

Fix GitHub Pages deploy failure by replacing subtree force-push flow#650
espresso3389 merged 2 commits into
masterfrom
copilot/fix-deploy-job-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

The deploy job in the GitHub Pages workflow was failing during git subtree push with remote commit_refs rejection. This change replaces the fragile subtree-based publish path with a direct gh-pages branch update flow.

  • Root issue addressed

    • Removed the git subtree split + force-push pattern that produced remote rejection on tmp -> gh-pages.
  • Deployment flow changes (.github/workflows/github-pages.yml)

    • Preserve generated site output in /tmp/deploy_temp.
    • Resolve gh-pages deterministically:
      • checkout remote gh-pages if it exists
      • otherwise initialize an orphan gh-pages branch
    • Replace branch contents with current build artifacts.
    • Commit only when there is an actual diff.
    • Push gh-pages directly (no subtree branch, no force push).
  • Behavioral impact

    • Deployment remains artifact-driven and idempotent.
    • No-op deployments now exit cleanly without creating empty commits.
- name: Deploy to GitHub Pages
  run: |
    mv deploy_temp /tmp/deploy_temp
    if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
      git fetch origin gh-pages
      git checkout -B gh-pages origin/gh-pages
    else
      git checkout --orphan gh-pages
      git rm -rf . || true
    fi
    find . -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
    cp -a /tmp/deploy_temp/. .
    git add -A
    if git diff --cached --quiet; then exit 0; fi
    git commit -m "$PDFRX_VERSION $GITHUB_SHA"
    git push origin gh-pages

Copilot AI changed the title [WIP] Fix failing GitHub Actions job deploy Fix GitHub Pages deploy failure by replacing subtree force-push flow May 27, 2026
Copilot AI requested a review from espresso3389 May 27, 2026 11:49
@espresso3389 espresso3389 marked this pull request as ready for review May 27, 2026 12:13
@espresso3389 espresso3389 merged commit bb5f6f8 into master May 27, 2026
12 checks passed
@espresso3389 espresso3389 deleted the copilot/fix-deploy-job-failure branch May 27, 2026 12:14
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