Skip to content

Add a manual trigger to the documentation workflow - #34

Open
hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:add_workflow_dispatch
Open

hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:add_workflow_dispatch

Conversation

@hakonhagland

Copy link
Copy Markdown
Collaborator

The workflow that builds and publishes the Python documentation can currently only be started by a push, a pull_request, or a repository_dispatch from opm-common or opm-simulators. When such a dispatch fails, there is no way to re-run the build from GitHub's web interface.

That happened after OPM/opm-simulators#7439 was merged: the dispatch from opm-simulators was rejected with 401 "Bad credentials", because the token it is sent with is no longer valid, and the published API reference was only updated after the dispatch was sent by hand through the API with other credentials. OPM/opm-simulators#7443 makes that kind of failure show up as a red job; this PR adds a way to recover from it once noticed.

Add a workflow_dispatch trigger (commit 1)

  • Adds workflow_dispatch: to .github/workflows/python_sphinx_docs.yml, with a short comment saying what it is for. Once this is on master, the workflow gets a "Run workflow" button in the Actions tab.
  • No other change was needed. The three expressions in the workflow that depend on the event or branch already behave sensibly for a manual run:
    • The branch list for sphinx-versioned uses github.base_ref || github.ref_name. For a manual run base_ref is empty, so the selected branch is used, as for push and repository_dispatch.
    • The gh-pages deploy step runs if: github.ref == 'refs/heads/master', so a manual run on master rebuilds and republishes the site. This is the recovery case.
    • The per-branch deploy step requires github.event_name == 'push', so a manual run on any other branch only builds and publishes nothing.

The published documentation is rebuilt on a push here or on a
repository_dispatch sent by opm-common or opm-simulators when their
docstring files change. When such a dispatch fails there is no way to
re-run the build short of sending the dispatch by hand through the API
or pushing a commit.

That happened after OPM/opm-simulators#7439 was merged: the dispatch was
rejected with 401 "Bad credentials" because the token opm-simulators
sends it with is no longer valid, and the documentation was only
republished once the dispatch was sent manually with other credentials.
OPM/opm-simulators#7443 makes that failure visible; this adds the way to
recover from it.

workflow_dispatch adds a "Run workflow" button to the Actions tab. The
existing conditions already give it sensible behavior: run on master,
github.ref is refs/heads/master and the gh-pages deploy step runs; run
on any other branch it builds only, since the per-branch deploy step
requires a push event. The branch list passed to sphinx-versioned falls
back to github.ref_name, which is the selected branch.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The reviewed change is focused and has no unresolved issues.

Review effort: Lite
Findings: None

What changed in this PR

Adds a manual trigger to the Python documentation workflow so failed builds can be rerun from GitHub Actions.

Changes:

  • Enables workflow_dispatch.
  • Documents deployment behavior for master and other branches.
File Description
.github/​workflows/​python_sphinx_docs.yml Adds the manual workflow trigger and usage guidance.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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