Repository navigation
Conversation
pre-comment writes 'Building and deploying preview...' and only the comment job replaces it, after a successful deploy. If build or deploy-preview fails the comment stays on 'Building' forever. Add a comment-failure job that rewrites it to a failure message with a link to the run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Member
Author
|
@elastic/docs-engineering could you review this? Where I'd like the most attention:
Independent of #450, which fixes why the build fails for fork PRs of private repositories. Either can merge alone. Untested end to end; a deliberately failing build on a test PR after the |
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.
Why
The preview comment on a PR can get stuck on "⏳ Building and deploying preview…" for good when the deploy workflow fails, so a failed deploy looks like a hung one.
How the comment works today in
docs-deploy.yml:pre-commentwrites⏳ Building and deploying preview... [View progress](<run url>).buildanddeploy-previewrun.commentreplaces it with the preview links, but only whendeploy-preview.outputs.deployed == 'true'.If
buildordeploy-previewfails,commentis skipped and nothing else touches the comment. The workflow also runs onworkflow_run, so it does not show up as a check on the PR; the comment is the only place the author sees it, and it says "building" indefinitely.Real example: https://github.com/elastic/cloud/pull/161041. The
buildjob failed at checkout (run, cause and fix in #450).deploy-previewandcommentwere skipped, and the PR still shows "Building and deploying preview…" a day later. The same happens for any otherbuildfailure (for example docs-builder errors understrict: true) or a failing S3 upload.What
A new
comment-failurejob, placed aftercomment. It runs when all of these hold:always(), so it still runs whenbuildfailed and later jobs were skippedpull_request, and the PR is not a fork PR from a non-member (the same audience condition aspre-commentandcomment)pre-commentsucceeded, so there is an in-progress comment to updatebuild.result == 'failure'ordeploy-preview.result == 'failure'inputs.disable-comments != trueIt rewrites the comment to:
("build" or "deployment", depending on which job failed.)
Design decisions:
pre-commentwrote. A comment from a newer run, or one already replaced by finished preview links, is never overwritten.cancel-in-progress, so a cancelled run means a newer run took over and owns the comment.comment:pull-requests: writeonly, everything elsenone. No checkout, no secrets, no PR content is used. Values reach the script throughenv, not template expansion.continue-on-error: truelike the other comment steps, so a comment problem never changes the workflow result.Separate from #450
#450 fixes why the build fails for fork PRs of private repositories. This PR is only about telling the author when any build or deploy fails. They are independent: either can merge alone, and this one also covers every other failure mode.
Testing
Done:
actionlintandzizmorpass ondocs-deploy.yml.githubclient with three comments (this run's in-progress comment, another run's in-progress comment, a finished preview comment):includes(runUrl)guard makes the third case fail (it then updates a comment it should not), so the test does exercise the guard.Not done: an end-to-end run, since this is a reusable
workflow_runworkflow that cannot be triggered from a branch. After merge and thev1tag move, a deliberately failing build on a test PR would confirm it.Not covered: when
buildsucceeds but reportsskip == 'true',deploy-previewis skipped without failing, so the comment may also stay on "Building". I have not checked whether that case can happen afterpre-comment; it is not handled here.🤖 Generated with Claude Code