Skip to content

Add PR comment step to codex-preview workflow - #239

Merged
theletterf merged 3 commits into
mainfrom
codex-preview-comment
Jul 22, 2026
Merged

Add PR comment step to codex-preview workflow#239
theletterf merged 3 commits into
mainfrom
codex-preview-comment

Conversation

@theletterf

Copy link
Copy Markdown
Member

Why

The codex-preview.yml workflow builds and deploys a preview on every PR, but never posts a comment with links — contributors have to hunt for the deployment URL themselves. Jan noted this was a natural follow-up after #238 landed.

What

Adds a comment job that runs after a successful deploy:

  • Normal PR (pages changed): posts per-page preview links under ## 🔍 Preview links for changed Codex pages, linking to https://codex.elastic.dev${PATH_PREFIX}/${path}.
  • Snippet/CSV-only PR: posts a blanket comment with the preview index URL (same fallback introduced in Post blanket comment when only snippets or CSV files change #238 for docs-deploy).
  • No docs changes: deploy is skipped → comment condition (needs.deploy.result == 'success') is false → no comment.

The comment is upserted (update if a bot comment with the same title exists, create otherwise), so re-runs don't spam the PR.

Test plan

  • Open a Codex PR that edits a page → comment appears with per-page link
  • Open a Codex PR that only edits _snippets/ → blanket fallback comment appears
  • Push a second commit → comment is updated in place, not duplicated

🤖 Generated with Claude Code

Posts per-page preview links (or a blanket fallback for snippet/CSV-only
PRs) as a PR comment after a successful Codex deploy, matching the
behaviour already present in docs-deploy.yml.

- Per-page links: strips docs/ prefix and .md extension, links to
  https://codex.elastic.dev${PATH_PREFIX}/${path}
- Snippet/CSV-only PRs: posts a blanket comment with the index URL
- No docs changes: comment step is skipped (deploy.result != success)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
theletterf requested a review from a team as a code owner July 22, 2026 10:56
@theletterf
theletterf requested a review from technige July 22, 2026 10:56
@theletterf theletterf self-assigned this Jul 22, 2026
@theletterf theletterf added the enhancement New feature or request label Jul 22, 2026
Comment thread .github/workflows/codex-preview.yml Outdated
Co-authored-by: Jan Calanog <jan.calanog@elastic.co>
Comment thread .github/workflows/codex-preview.yml Outdated
@theletterf
theletterf requested a review from reakaleek July 22, 2026 11:03
Address review feedback: the check job already has the list of changed
files via tj-actions/changed-files. Expose all_changed_files as a job
output, pass it to comment via env var, and split on spaces instead of
paginating the pulls.listFiles API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf
theletterf merged commit a493ba5 into main Jul 22, 2026
4 checks passed
@theletterf
theletterf deleted the codex-preview-comment branch July 22, 2026 11:10
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