Add changelog/comment composite and release-notes-comments reusable workflow - #323
Merged
Merged
Conversation
The reusable PR-review workflow's conclusion and safe_outputs jobs request issues:write for failure and no-op run tracking, but this workflow granted only issues:read. GitHub rejects the permission escalation before any job starts, so the workflow's own review of this PR flagged the same gap for discussions:write. Both are now granted. Also suppress actionlint's false-positive "unknown permission scope copilot-requests" — the scope is valid at GitHub Actions runtime, actionlint just doesn't recognize it yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
…orkflow validate now passes fork-context flags (--is-fork, --can-commit, --maintainer-can-modify, --head-repo) to evaluate-pr and uploads the decision artifact with if: always() so a downstream workflow_run job can post the sticky PR comment on both success and failure paths. The new changelog/comment composite downloads the cross-run artifact and runs changelog github-comment. The release-notes-comments.yml reusable workflow wires the workflow_run trigger to the composite with pull-requests: write and cancel-in-progress: false. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <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.
Repos using
changelog-validatenow upload achangelog-decisionartifact on every PR run. Repos that want the sticky PR comment opt in by copying oneworkflow_runtrigger workflow that calls the newrelease-notes-comments.ymlreusable workflow.Affects: Release notes, Automation
Why
validate-labelsandevaluate-prindocs-buildernow write a decision-metadata file on CI (merged in elastic/docs-builder#3993). The metadata travels across theworkflow_runboundary as an artifact so a job withpull-requests: writecan post the comment without the triggering event needing write access. Fork PRs have the same problem: GitHub forces the token read-only onpull_requestfrom a fork, so commenting must happen in a separateworkflow_runjob. This PR is the docs-actions half — it uploads the artifact and provides the comment composite and reusable workflow.What
Fork-context flags passed to
evaluate-prThe
changelog/validatecomposite gains four new env vars (IS_FORK,MAINTAINER_CAN_MODIFY,HEAD_REPO, computed frompull_requestevent fields) and maps them to--is-fork,--can-commit,--maintainer-can-modify,--head-repoflags.can-commitis true for same-repo PRs; for forks it requiresmaintainer_can_modify. These fields travel intometadata.jsonso the comment renderer can choose the right guidance variant.Artifact upload in
changelog/validateA new
Upload decision artifactstep runsif: always()at the end of the composite, uploading.artifacts/changelog-decisionaschangelog-decisionwith one-day retention andif-no-files-found: ignore. Theif: always()means a failing gate (missing label) still uploads — the comment job needs the metadata to explain what is missing.changelog/commentcompositeDownloads
changelog-decisioncross-run usinggithub.event.workflow_run.id, sets updocs-builder, and runschangelog github-comment --metadata /tmp/changelog-decision/metadata.json. Follows the same check-then-download guard asvale/reportto handle cancelled upstream runs gracefully.release-notes-comments.ymlreusable workflowTriggered via
workflow_call(callers useworkflow_runon their upstream workflows). Runs thechangelog/commentcomposite withpull-requests: writeandcontents: none. Concurrency is keyed on the repo + branch withcancel-in-progress: false— two upstream workflows can land close together, and cancelling mid-upsert risks leaving the wrong comment body.Verify
Copy this trigger workflow into a test repo's default branch and open a PR with no changelog type label:
A sticky
### 📋 Changelogcomment should appear on the PR naming the missing label. Adding the label and pushing should edit the same comment to the resolved body.Stack: 2 of 4, on top of elastic/docs-builder#3993. PR 3 strips the JS from
submit/apply(coordinated withelastic/cloud). PR 4 dropsshould-comment-success/should-comment-failurefromdocs-builder.Out of scope:
changelog/submitis not touched.submit/applystill posts via its existing JS steps. The two implementations converge on one comment during the overlap window — the sticky-comment identity guarantee (marker at end,### 📋 Changelogprefix first) was established in PR 1.