Skip to content

Make the documentation dispatch job fail when GitHub rejects the request - #7443

Merged
blattms merged 2 commits into
OPM:masterfrom
hakonhagland:fix_dispatch_silent_failure
Sep 25, 2026
Merged

blattms merged 2 commits into
OPM:masterfrom
hakonhagland:fix_dispatch_silent_failure

Conversation

@hakonhagland

Copy link
Copy Markdown
Contributor

The job in .github/workflows/dispatch_opm_simulators.yml, which tells opm-python-documentation to rebuild the Python API reference after python/docstrings_simulators.json changes, reports success even when the dispatch is rejected. After #7439 was merged the job was green, but its log shows:

{
  "message": "Bad credentials",
  "documentation_url": "https://docs.github.com/rest",
  "status": "401"
}

No documentation build was triggered, and nothing in the Actions UI said so. The published reference was only updated after the dispatch was sent by hand.

This PR does not fix the credentials — the PERSONAL_ACCESS_TOKEN secret needs renewing by someone with admin rights here. It makes the next failure of this kind visible instead of silent.

Fail the dispatch job when GitHub rejects the request (commit 1)

  • The step posts with a bare curl -X POST. curl exits 0 for any HTTP response, including 401, so the step's shell sees success and the job passes.
  • Added --fail-with-body: on an HTTP status of 400 or above curl now exits with status 22, which fails the step, while still printing the response body, so the log keeps the reason. Plain --fail would discard the body and leave only the status code.
  • A successful dispatch returns 204 and is unaffected.

Name the dispatch step after the repository it notifies (commit 2)

  • The step was labeled "Send dispatch to opm-simulators", but it runs in opm-simulators and sends the dispatch to opm-python-documentation. The label is what the Actions UI prints for the step, so when the dispatch failed, the log pointed at the wrong repository.
  • Label only; no behavior change. Separate commit so it can be dropped if preferred.

Verification

  • Reproduced locally against the same endpoint with a deliberately invalid token, under bash -e -o pipefail as a GitHub Actions run: step uses. The current command printed the same Bad credentials body as the CI log and exited 0; with --fail-with-body it printed the same body and exited 22.
  • The workflow file parses as valid YAML after both changes.
  • Not verified in CI: the success path needs a valid token, so it rests on curl's documented behavior of failing only on status 400 or above. --fail-with-body needs curl 7.76 or newer; the runner image is Ubuntu 24.04, which ships curl 8.5.

The first real test will be the next merge that touches python/docstrings_simulators.json: with the secret still invalid that job will now be red, and once the secret is renewed it should be green with a documentation build following it.

🤖 Generated with Claude Code

The dispatch step posts to the GitHub API with a bare curl. curl exits 0
for any HTTP response, including an error, so when the request is
rejected the step prints the error body and the job still reports
success.

That is what happened after OPM#7439 was merged: the job was green, but its
log shows

  "message": "Bad credentials",
  "status": "401"

and no documentation build was triggered. Because the job stayed green,
nothing indicated that the published Python API reference had not been
updated.

With --fail-with-body, curl still prints the response body, so the log
keeps the reason, but exits with status 22 on an HTTP error, which fails
the step. A successful dispatch returns 204 and is unaffected.
The step was labeled "Send dispatch to opm-simulators", but it runs in
opm-simulators and sends the dispatch to opm-python-documentation. The
label is what the Actions UI shows for the step, so when the dispatch
fails, the log points at the wrong repository.
@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Sep 23, 2026
@hakonhagland
hakonhagland requested a lite review from Copilot September 23, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 narrowly scoped workflow changes address the silent failure without introducing unresolved issues.

Review effort: Lite
Findings: None

What changed in this PR

Updates the documentation dispatch workflow to surface rejected GitHub API requests and clarify the target repository.

Changes:

  • Adds curl --fail-with-body to fail on HTTP errors while retaining response details.
  • Renames the dispatch step to identify opm-python-documentation.
File Summary
.github/​workflows/​dispatch_opm_simulators.yml Improves dispatch failure detection and step labeling.

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

@blattms
blattms merged commit 94378df into OPM:master Sep 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants