Add native sticky PR comment infrastructure for changelog validation - #3993
Open
Mpdreamz wants to merge 3 commits into
Open
Add native sticky PR comment infrastructure for changelog validation#3993Mpdreamz wants to merge 3 commits into
Mpdreamz wants to merge 3 commits into
Conversation
bundle-create resolves gh-release vs bundle from changelog.yml via bundle --plan; no profiles → gh-release, profiles present → bundle. The explicit mode input has been removed from changelog-bundle.yml. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Renames ChangelogArtifactMetadata → GithubDecisionMetadata (wire-safe, snake_case names unchanged), adds two hidden CLI commands (changelog github-decision / github-comment), a GitHubCommentService with paginated sticky-comment upsert that stays bidirectionally compatible with the existing JS comment-helper, and a ChangelogCommentRenderer porting all four JS body variants. validate-labels and evaluate-pr now write the decision metadata file when running on CI, so a downstream workflow_run job can post or update the comment without pull-requests: write on the triggering event. should-comment-success / should-comment-failure outputs are retained for elastic/cloud compatibility until PR 4. Co-Authored-By: Claude <noreply@anthropic.com>
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/3993/ Sample changed pages: |
theletterf
approved these changes
Sep 1, 2026
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.
docs-buildergains the full native infrastructure to post and update a sticky PR comment from changelog validation — so any repo can opt in by copying one workflow file, without needing the fullchangelog-submitchain.Affects: Release notes, CLI
Why
Repos on the minimal release-notes path (
validate-labels,evaluate-pr) get a red check when labels are wrong but no comment explaining which label is missing. The rich diagnostic already exists as JavaScript inchangelog/submit/apply/scripts/, but it is reachable only from theapplyjob — repos without a changelog-file workflow never see it. Fork PRs make this worse: GitHub forces the token read-only onpull_requestfrom a fork regardless ofpermissions:, so commenting must happen in aworkflow_runjob with a separate token. This PR lays the foundation so a singlerelease-notes-comments.ymlfile can cover both paths.What
Rename
ChangelogArtifactMetadata→GithubDecisionMetadataThe old name implied the record was about the artifact file. Every field in it steers a GitHub Actions decision:
CanCommit,HeadRef/HeadShafor the checkout step,LabelTable/Statusfor the comment body. The rename is wire-safe —PropertyNamingPolicy = JsonKnownNamingPolicy.SnakeCaseLowerderives JSON names from properties, so existingmetadata.jsonfiles still deserialize. Two new optional fields are added:CommitOutcome(enumNone | Committed | Failed) andCommittedFile.Decision metadata written on CI from
validate-labelsandevaluate-prBoth commands now write
.artifacts/changelog-decision/metadata.jsonwhenGITHUB_ACTIONSis set and a PR number is supplied. The write is purely additive — exit codes, existing step outputs, and theshould-comment-success/should-comment-failureoutputs are unchanged..artifactsis already gitignored and allow-listed byRunnerTempFileSystem.Two hidden CLI commands:
changelog github-decisionandchangelog github-commentgithub-decisionreads the metadata file and stampsCommitOutcome+CommittedFileinto it.github-commentreads the file and posts or updates the PR comment. Both are[Hidden]— absent from--helpand autocomplete, but visible in__schemawithhidden: trueand fully functional when invoked. Schema regenerated.Sticky-comment upsert with pagination and JS bidirectional compatibility
GitHubCommentService.UpsertStickyCommentAsyncpaginates through all PR comments (100 per page) to find the existing sticky comment. It matches on the<!-- docs-builder:changelog -->marker at the end of the body, or the legacy### 📋 Changelogprefix that the existingcomment-helper.jswrites. During the overlap window both implementations converge on one comment; with the marker at the end rather than the start, the JSstartsWithcheck still matches.Comment body renderer
ChangelogCommentRendererports all four JS body variants:entry-committed(blob + edit links with URL-encoded path components),comment-only(YAML fenced with guidance variants for commit-failed, fork, or informational),cannot-generate(headline + label tables + skip-label list), andresolved(edits a stale failure comment to a short success body so the PR is never left with a misleading comment). Code-fence escaping uses the longest backtick run in content + 1; inline code pads when the value starts or ends with a backtick. Body is capped at GitHub's 65 536-character limit.Verify
Stack: 1 of 4. PR 2 adds
release-notes-comments.ymlto docs-actions and uploads the artifact fromrelease-notes.yml. PR 3 strips the JS fromsubmit/apply(coordinated withelastic/cloud). PR 4 dropsshould-comment-success/should-comment-failureonce nothing reads them.Out of scope:
should-comment-success/should-comment-failurestep outputs are intentionally kept. Removing them now would silently stopelastic/cloud's changelog-submit comment steps from firing.