Skip to content

ci: improve pkg.pr.new install comment clarity#168

Merged
kongenpei merged 3 commits intomainfrom
codex/improve-pkg-pr-new-comment
Apr 1, 2026
Merged

ci: improve pkg.pr.new install comment clarity#168
kongenpei merged 3 commits intomainfrom
codex/improve-pkg-pr-new-comment

Conversation

@kongenpei
Copy link
Copy Markdown
Collaborator

@kongenpei kongenpei commented Apr 1, 2026

Summary

Improve the pkg.pr.new PR comment so the install guidance is clearer and harder to miss.

Changes

  • Add a clear top-level header in the bot comment.
  • Split install instructions into two markdown sections: CLI update and Skill update.
  • Add npx skills add <source_repo>#<source_branch> -y -g based on PR source repo/branch.
  • Use a stable HTML marker to find/update the existing bot comment reliably.

Summary by CodeRabbit

  • New Features

    • PR comments now include a structured "PR Preview Install Guide" with a CLI install snippet and, when available, an additional "Skill update" section.
  • Chores

    • Improved bot comment handling to reliably update prior comments.
    • Shows a clear "Unavailable…metadata is missing" placeholder when PR metadata needed for the CLI/skill snippet is not present.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

The GitHub Actions workflow .github/workflows/pkg-pr-new.yml was updated to add a stable HTML marker for bot comments, extract sourceRepo and sourceBranch from pull_request.head, conditionally emit an npx skills add line or a missing-metadata note, and change prior-comment detection from startsWith to includes.

Changes

Cohort / File(s) Summary
GitHub Actions workflow
.github/workflows/pkg-pr-new.yml
Adds HTML marker <!-- pkg-pr-new-install-guide --> to bot comment body; reads pull_request.head.repo.full_name and pull_request.head.ref into sourceRepo/sourceBranch with presence checks; conditionally appends npx skills add ${sourceRepo}#${sourceBranch} -y -g or an “Unavailable…metadata is missing” placeholder; switches prior-comment detection from startsWith(...) to includes(...); restructures comment sections (PR Preview Install Guide, CLI update, optional Skill update).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • liangshuo-1

Poem

"I’m a rabbit in CI, I hop through each change,
I plant a tiny marker to brighten the range,
I write the install steps and hint at a skill,
A npx little flourish — quick, neat, and chill! 🐇"

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improving the clarity of the pkg.pr.new bot's install comment through structured formatting, headers, and updated comment detection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/improve-pkg-pr-new-comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR improves the pkg.pr.new CI workflow comment by splitting the install guidance into two clearly-labelled sections ("CLI update" and "Skill update") and switching comment detection from a fragile startsWith string match to a stable embedded HTML marker (<!-- pkg-pr-new-install-guide -->).

Key changes:

  • Structured Markdown body with a top-level header and two ### sub-sections for clarity.
  • npx skills add <repo>#<branch> -y -g command dynamically built from PR metadata.
  • Graceful fallback when sourceRepo/sourceBranch is unavailable (e.g. deleted fork) — the section renders an explanatory message instead of failing or throwing.
  • Comment lookup changed from startsWith("Install this PR change globally:") to includes("<!-- pkg-pr-new-install-guide -->"), making it robust against future body-text changes.

One minor transition note: Existing open PRs that already carry the old-format bot comment won't be detected by the new marker, so their next workflow run will create a second comment rather than update the existing one. This resolves itself naturally as PRs close, but a one-time backward-compatible guard in the find predicate would prevent duplicates entirely.

Confidence Score: 5/5

Safe to merge; all changes are cosmetic improvements to CI comment formatting with no impact on build or release logic.

The only finding is a P2 transition concern about duplicate comments on already-open PRs — a one-time cosmetic issue with no functional consequences. The previous P1 concern (hard failure on deleted-fork PRs) has been fully addressed by the new graceful fallback.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/pkg-pr-new.yml Refactors PR comment to use a structured install guide with a stable HTML marker; gracefully handles missing fork metadata; one minor transition issue where pre-existing old-format comments won't be detected for update.

Sequence Diagram

sequenceDiagram
    participant W as Workflow (pkg-pr-new.yml)
    participant G as GitHub API

    W->>W: Build preview package
    W->>W: Publish to pkg.pr.new → output.json
    W->>W: Read url from output.json
    W->>W: Read sourceRepo & sourceBranch from PR payload
    W->>W: Build body with HTML marker + CLI section + Skill section
    W->>G: List PR comments (paginated)
    G-->>W: comments[]
    W->>W: Find comment with "pkg-pr-new-install-guide" marker
    alt Marker found (existing comment)
        W->>G: updateComment(comment_id, body)
    else No marker found
        W->>G: createComment(issue_number, body)
    end
Loading

Reviews (3): Last reviewed commit: "ci: avoid hard fail when PR head metadat..." | Re-trigger Greptile

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/pkg-pr-new.yml:
- Line 63: The install command uses unsupported repo#branch syntax in the string
`npx skills add ${sourceRepo}#${sourceBranch} -y -g`; change it to use the full
GitHub URL with the branch path by replacing `${sourceRepo}#${sourceBranch}`
with `https://github.com/${sourceRepo}/tree/${sourceBranch}` so the `npx skills
add` invocation installs from the specified branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9555eb5a-3112-430b-8ce4-f6ea487d5ce3

📥 Commits

Reviewing files that changed from the base of the PR and between bdd39b0 and 064ab79.

📒 Files selected for processing (1)
  • .github/workflows/pkg-pr-new.yml

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@fe09a9061d3ac4adb99416c755b5dfc51120d954

🧩 Skill update

npx skills add larksuite/cli#codex/improve-pkg-pr-new-comment -y -g

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/pkg-pr-new.yml (1)

54-54: ⚠️ Potential issue | 🟠 Major

Use a documented branch source format for skills add.

Line 54 uses owner/repo#branch, which is likely not a supported branch selector for the skills CLI, so the generated install command can fail or ignore the intended branch.

Proposed fix
-                  `npx skills add ${sourceRepo}#${sourceBranch} -y -g`,
+                  `npx skills add https://github.com/${sourceRepo}/tree/${sourceBranch} -y -g`,
In the official Skills CLI documentation, what is the supported syntax for installing from a specific non-default branch using `npx skills add`?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pkg-pr-new.yml at line 54, The workflow currently builds
the install command as `npx skills add ${sourceRepo}#${sourceBranch} -y -g`, but
the Skills CLI expects the documented branch selector format; update the
template to use the CLI's supported branch syntax (e.g., replace
`${sourceRepo}#${sourceBranch}` with the documented branch spec such as
`${sourceRepo}:${sourceBranch}` or whatever the Skills docs require) and verify
against the official Skills CLI docs so `npx skills add` installs the correct
non-default branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/pkg-pr-new.yml:
- Line 54: The workflow currently builds the install command as `npx skills add
${sourceRepo}#${sourceBranch} -y -g`, but the Skills CLI expects the documented
branch selector format; update the template to use the CLI's supported branch
syntax (e.g., replace `${sourceRepo}#${sourceBranch}` with the documented branch
spec such as `${sourceRepo}:${sourceBranch}` or whatever the Skills docs
require) and verify against the official Skills CLI docs so `npx skills add`
installs the correct non-default branch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0269276c-279b-4f67-bfbf-62b356fada79

📥 Commits

Reviewing files that changed from the base of the PR and between 12eaa1a and fe09a90.

📒 Files selected for processing (1)
  • .github/workflows/pkg-pr-new.yml

@kongenpei kongenpei requested a review from liangshuo-1 April 1, 2026 03:09
@kongenpei kongenpei merged commit c4851a5 into main Apr 1, 2026
8 checks passed
@kongenpei kongenpei deleted the codex/improve-pkg-pr-new-comment branch April 1, 2026 03:15
tuxedomm pushed a commit that referenced this pull request Apr 3, 2026
* ci: improve pkg.pr.new install comment clarity

* ci: add emojis to pkg.pr.new install comment headings

* ci: avoid hard fail when PR head metadata is missing

---------

Co-authored-by: kongenpei <kongenpei@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants