@chronus/github-pr-commenter

中文文档
1.1.2发布于 2026/09/12MITES Module构建来源已验证近 30 天下载 2.4万

克罗纳斯

中文使用文档

Chronus github pr 注释器

要使用的软件包 @chronus/github 用更改日志评论 PR .

这必须用在 github 描述的 2 个步骤中 这里。 。 。 .

Pr 工作流程检查更改并创建注释 :

name: Check Changes

on:
  pull_request:
    branches:
      - main

permissions:
  pull-requests: write

jobs:
  changes:
    if: ${{ github.actor != 'dependabot[bot]' && !startsWith(github.head_ref, 'publish/') }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 ## Needed for changelog
      - uses: ./.github/actions/setup

      - uses: pnpm/action-setup@v3
        name: Install pnpm

      - run: pnpm install
        name: Install dependencies

      - name: Create PR Comment
        run: pnpm chronus-github get-pr-comment --out ./comment-out/comment.json
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

      - uses: actions/upload-artifact@v4
        with:
          name: comment
          path: comment-out/
          retention-days: 1 # Only need for the next workflow so don't need to waste storageretention-days

      - run: pnpm chronus verify
        name: Verify changes

从其他工作流程中编写 PR 注释的工作流程

name: Make Change Comment

on:
  workflow_run:
    workflows: ["Changes"]
    types:
      - completed

permissions:
  pull-requests: write

jobs:
  # DO NOT BUILD ANYTHING FROM A PR HERE https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
  commenter:
    if: >
      github.event.workflow_run.event == 'pull_request' &&
      github.actor != 'dependabot[bot]'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/download-artifact@v4
        with:
          name: comment
          run-id: ${{github.event.workflow_run.id }}
          github-token: ${{secrets.GITHUB_TOKEN}}
      - name: Display structure of downloaded files
        run: ls -R

      - uses: ./.github/actions/setup

      - run: pnpm install
        name: Install dependencies

      - run: pnpm chronus-github-pr-commenter --comment-file comment.json
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
        name: Create/update comment

版本与发布记录

@chronus/github-pr-commenter 共发布 40 个版本,首次发布于 2024/01/29;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.1.2latest2026/09/121 个月前
1.1.12026/07/293 个月前
1.1.02026/07/163 个月前
1.0.62026/03/117 个月前
1.0.52026/02/059 个月前
1.0.42026/01/289 个月前

关于 @chronus/github-pr-commenter 的常见问题

@chronus/github-pr-commenter 是什么?

克罗纳斯

如何安装 @chronus/github-pr-commenter?

在项目目录运行 npm install @chronus/github-pr-commenter,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 chronus-github-pr-commenter,可以用 npx chronus-github-pr-commenter 直接运行。

@chronus/github-pr-commenter 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/chronus__github-pr-commenter 是否存在。

@chronus/github-pr-commenter 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@chronus/github-pr-commenter 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@chronus/github-pr-commenter 可以商用吗?

@chronus/github-pr-commenter 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chronus/github-pr-commenter 的下载量有多少?

根据 npm 官方下载统计,@chronus/github-pr-commenter 在 2026/10/10 – 2026/11/08 这 30 天内被下载 24,135 次,日均约 805 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@chronus/github-pr-commenter 还在维护吗?

最新版本 1.1.2 发布于 2026/09/12(1 个月前);至今共发布 40 个版本,其中过去 12 个月发布了 6 个;首次发布于 2024/01/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。