ci(docs): fail the docs job when its install fails - #383
Open
thodson-usgs wants to merge 1 commit into
Open
Conversation
Setting `shell:` replaces the default `bash -e {0}`, and `bash -l {0}`
carries no `-e`, so a failed `pip install .[doc,nldi]` did not stop the
step. The build ran on against whatever was already on the runner and died
later at `sphinx-build: not found` (exit 127), naming the wrong culprit.
Worse, the step exits 0 whenever a stale sphinx is present, so docs built
from a failed install would deploy to gh-pages as if nothing were wrong.
Also stop building on tag pushes. Naming `branches` alone is what excludes
them -- "if you define only branches/branches-ignore, the workflow won't
run for events affecting the undefined Git ref" -- while `tags-ignore`
alone would have excluded branches instead and stopped docs entirely. The
deploy step is gated on refs/heads/main, so a tag build can never publish;
GitHub pushes an `untagged-<sha>` placeholder tag for every draft release,
and each one started a docs build that failed in setuptools_scm, which
cannot parse that ref as a version.
Both were surfaced by the v1.3.0 release going out with
`untagged-13b6562c80438aa8ea78` as its tag instead of `v1.3.0`.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two one-line changes to
.github/workflows/sphinx-docs.yml.1.
shell: bash -l {0}→bash -leo pipefail {0}. Settingshell:replaces the defaultbash -e {0}, and-lalone carries no-e, so a failed install did not stop the step. In the v1.3.0 release build,pip install .[doc,nldi]failed and the step ran on toaptandmake html, finally dying atsphinx-build: not found(exit 127) — naming the wrong culprit.The latent hazard is worse than the confusing message: with a stale sphinx present on the runner, that step exits 0, so a docs set built from a failed install would deploy to gh-pages as if nothing were wrong.
Demonstrated locally:
2. Push trigger →
branches: ["**"], so tag pushes no longer start docs builds. The deploy step is already gated onrefs/heads/main, so a tag build can never publish anything; meanwhile GitHub pushes anuntagged-<sha>placeholder tag for every draft release, and each one starts a docs build that fails insetuptools_scm, which cannot parse that ref as a version.Naming
branchesalone is what excludes tags, per the workflow-syntax reference: "if you define onlytags/tags-ignoreor onlybranches/branches-ignore, the workflow won't run for events affecting the undefined Git ref." Note that the reflexivetags-ignore: ["**"]spelling would have done the opposite — excluding branch pushes and stopping docs builds entirely.Testing
{push: {branches: ['**']}, pull_request: None}.actionlint: no new findings versusmain(the 3 pre-existing warnings about undefined inputs on the pages-deploy action are unchanged).-ewith a login shell is the combinationsetup-minicondarecommends for GitHub runners.check-yamlpassed.Note
This does not turn the current red CI green. Those failures come from the v1.3.0 release having been published with
untagged-13b6562c80438aa8ea78as its tag instead ofv1.3.0; that tag sits onmain's tip, sosetuptools_scmcannot infer a version and any build from source fails. That needs to be fixed separately, by deleting the release and the stray tag and re-releasing on a realv1.3.0tag.🤖 Generated with Claude Code