Skip to content

Strip JS comment steps from submit/apply; add github-decision + artifact upload - #324

Closed
Mpdreamz wants to merge 2 commits into
mainfrom
feature/changelog-pr-comment-part3
Closed

Mpdreamz wants to merge 2 commits into
mainfrom
feature/changelog-pr-comment-part3

Conversation

@Mpdreamz

@Mpdreamz Mpdreamz commented Sep 1, 2026

Copy link
Copy Markdown
Member

The three actions/github-script comment steps and their four JS scripts are removed from changelog/submit/apply. Commenting now happens in the downstream release-notes-comments workflow (added in #323). A new shell step records the commit outcome into the metadata and uploads it as changelog-decision so the comment workflow picks it up.

Affects: Release notes, Automation

Why

Commenting from inside submit/apply required pull-requests: write on the commit job. The JS scripts (post-success-comment.js, post-comment-only.js, post-failure-comment.js) were the only things in the repo that posted PR comments. Moving them to a dedicated workflow_run job with its own token gives the commit job a narrower permission set and lets any future consumer opt into comments by copying one file instead of modifying the submit workflow. The three steps also lacked continue-on-error: true, so a transient 403 from the GitHub API could fail a run that otherwise committed the entry successfully.

What

JS scripts removed

All four scripts in changelog/submit/apply/scripts/ (comment-helper.js, post-success-comment.js, post-comment-only.js, post-failure-comment.js) are deleted. The config input — used only by post-failure-comment.js — is also removed from the composite.

Record decision and stage comment artifact step

After the commit step, a single shell step runs if: always() with continue-on-error: true. It copies the staging metadata and generated YAML into .artifacts/changelog-decision/, calls changelog github-decision --commit-outcome <committed|failed|none> to stamp the outcome, and sets --committed-file when the commit succeeded. The directory layout matches what changelog github-comment expects.

Upload decision artifact step

Uploads .artifacts/changelog-decision as changelog-decision with if: always() and continue-on-error: true, if-no-files-found: ignore. The downstream release-notes-comments workflow (PR #323) picks this up with pull-requests: write and posts or updates the sticky comment.

Verify

Open a PR in a repo that has release-notes-comments.yml wired up. The Changelog submit workflow should complete without posting a comment itself. A few seconds later the Changelog PR comments workflow should run and post (or update) the sticky ### 📋 Changelog comment.

Stack: 3 of 4, on top of #323. PR 4 drops should-comment-success / should-comment-failure from docs-builder once this PR is merged and no code reads those outputs.

Risk: elastic/cloud currently reads should-comment-success and should-comment-failure from submit/apply/evaluate-artifact. Those outputs are on ChangelogArtifactEvaluationService, not apply. They are dropped in the coordinated docs-builder PR 4 — this PR does not touch them.

Out of scope: changelog/submit/evaluate is untouched. changelog-submit.yml is untouched. elastic/cloud's consumer workflow must have release-notes-comments.yml in place on its default branch before this PR is merged.

…act upload

The three actions/github-script comment steps (post-success-comment,
post-comment-only, post-failure-comment) and their four JS scripts are
removed. In their place, a single shell step copies the staging metadata
and YAML into .artifacts/changelog-decision/, calls
changelog github-decision to stamp CommitOutcome, then uploads the
changelog-decision artifact with if: always() and continue-on-error: true.

The downstream release-notes-comments workflow (added in #323) picks up
this artifact and posts the sticky comment with pull-requests: write,
keeping comment responsibility out of the commit job.

The config input is removed from the action; it was only used in the now-
deleted post-failure-comment step.

Co-Authored-By: Claude <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner September 1, 2026 15:53
@Mpdreamz Mpdreamz added the enhancement New feature or request label Sep 1, 2026
@Mpdreamz
Mpdreamz requested a review from theletterf September 1, 2026 15:53
SKIP_LABELS: ${{ steps.meta.outputs.skip-labels }}
CONFIG_FILE: ${{ inputs.config }}
# Copy the generated YAML so the comment renderer can show it in comment-only mode
GENERATED=$(ls /tmp/changelog-staging/*.yaml 2>/dev/null | head -1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P2 (Medium)

Allow this lookup to succeed when no YAML was generated. Missing-label evaluations upload metadata without a YAML file, but shell: bash enables -e -o pipefail, so the failing ls terminates this step before github-decision runs; the subsequent nonempty check is never reached. The upload then publishes raw staging metadata instead of the intended decision for the failure-comment path. Handle an empty glob without failing so metadata-only artifacts also reach decision recording.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

theletterf added a commit that referenced this pull request Oct 26, 2026
* Post changelog-file PR comments from the same run

Remove the github-script comment steps and JS scripts from
changelog/submit/apply. The action now records the decision with
changelog github-decision and uploads it as changelog-decision, only in
the cases where the JS steps commented: committed, commit failed,
comment-only, and no-label.

A new comment job in release-notes-changelog-file.yml and
changelog-submit.yml posts the comment from that artifact through
changelog/comment with the new current-run input. The apply job drops
to pull-requests: read. The fork-guidance decision uses the same job.

Related to elastic/docs-eng-team#1131. Replaces #324.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* TEMP: point changelog-file at this branch for the playground test (revert before merge)

* Revert "TEMP: point changelog-file at this branch for the playground test (revert before merge)"

This reverts commit 8b7b17c.

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants