Skip to content

Fix the docs deploy job by pushing with GITHUB_TOKEN - #83

Merged
k-yoshimi merged 2 commits into
developfrom
fix-docs-deploy-token
Aug 17, 2026
Merged

Fix the docs deploy job by pushing with GITHUB_TOKEN#83
k-yoshimi merged 2 commits into
developfrom
fix-docs-deploy-token

Conversation

@k-yoshimi

@k-yoshimi k-yoshimi commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Problem

The deploy workflow has failed on every run since 2026-06-16 (last success: 2025-12-13), so the published documentation has not been updated since then. Every run fails at the final push:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
##[error]Process completed with exit code 128.

The workflow writes the GH_ACTIONS_DEPLOY_KEY secret to ~/.ssh/id_rsa and pushes to gh-pages over SSH. The secret is still present, but the repository has no deploy keys registered any more, so the matching public key is gone and the push can never authenticate.

Change

Drop the SSH key entirely and push over HTTPS using the credentials that actions/checkout already persists for GITHUB_TOKEN, granting the job contents: write.

This removes a long-lived credential that has to be rotated by hand and that silently breaks the deploy when it goes missing — exactly what happened here.

Because the job now carries a write-capable token through every step, rlespinasse/github-slug-action is pinned to a commit rather than resolved through the mutable v4.x tag. The pinned commit is what v4.x resolves to today (also tagged v4.5.0), so runtime behaviour is unchanged.

Verification

Both the previous and the new workflow were run on the ghactions branch, which the workflow already lists as a deploy target.

  • The push to gh-pages succeeds and the branch is updated.
  • The push starts the GitHub Pages build on its own. For the run whose Push step contained no Pages API call at all, exactly one build was created for the pushed commit 301cf839, attributed to github-actions[bot], finishing with status built and no error after 28.9 s.
  • The published site under docs/ghactions/ was refreshed.

An explicit POST /pages/builds call was tried during development and then removed: it raced with the build the push had already started and left a spurious failed-build record.

A temporary marker file was used to force a gh-pages diff during one run so that the commit and push path was actually exercised; it has since been removed from gh-pages and is not part of this branch.

Known scope limits

permissions is scoped per job in GitHub Actions, not per step, so the push credential is present while the documentation is built. Isolating it properly means splitting build and publish into separate jobs and passing the built docs as an artifact. That restructuring is deliberately left out of this change, whose purpose is to make the deploy authenticate at all, and is reasonable follow-up work.

Follow-up (not in this PR)

The GH_ACTIONS_DEPLOY_KEY secret is unused after this change and no longer functional. It can be deleted from the repository settings.

The two failing Unit jobs on this branch are unrelated to it: they are the pymatgen Structure.to argument-order problem that exists on develop and is fixed by #84. This branch only touches .github/workflows/deploy_docs.yml.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Cv7Xn4Q8TSpLjpg9aDpuhi

Kazuyoshi Yoshimi and others added 2 commits August 18, 2026 07:23
The docs deploy job has been failing since 2026-06-16 with
"git@github.com: Permission denied (publickey)". The workflow writes the
GH_ACTIONS_DEPLOY_KEY secret to ~/.ssh/id_rsa and pushes over SSH, but the
matching public key is no longer registered on the repository (the deploy
key list is empty), so the push can never authenticate.

Drop the SSH key entirely and push over HTTPS using the credentials that
actions/checkout already persists for GITHUB_TOKEN, with contents: write
granted to the job. This removes the long-lived key as both a maintenance
burden and a failure mode. The push still starts the GitHub Pages build,
so the published site keeps updating as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cv7Xn4Q8TSpLjpg9aDpuhi
Granting the deploy job contents: write makes the GITHUB_TOKEN available to
every step, including the third-party slug action. Previously the SSH key was
written only after the docs were built, so that action never ran alongside a
credential that could push.

Resolve rlespinasse/github-slug-action from a commit instead of the mutable
v4.x tag. The pinned commit is what v4.x currently resolves to (also tagged
v4.5.0), so the workflow behaves exactly as it does today.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cv7Xn4Q8TSpLjpg9aDpuhi
@k-yoshimi
k-yoshimi force-pushed the fix-docs-deploy-token branch from a1b5e69 to b763b7c Compare August 17, 2026 22:23
@k-yoshimi
k-yoshimi merged commit 2e005ba into develop Aug 17, 2026
24 of 25 checks passed
@k-yoshimi
k-yoshimi deleted the fix-docs-deploy-token branch August 17, 2026 22:40
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