# @chronus/github-pr-commenter 中文文档

规范地址：https://npmcn.com/package/%40chronus/github-pr-commenter/

版本：1\.1\.2
npm 元数据更新时间：2026-09-11T16:01:38.735Z
中文译文更新时间：2026-11-09T15:23:56.386Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40chronus/github-pr-commenter
原文对照：https://npmcn.com/package/%40chronus/github-pr-commenter/?lang=original
项目主页：https://github.com/timotheeguerin/chronus#readme
源码仓库：https://github.com/timotheeguerin/chronus

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：9.1 kB，7 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=22\.0\.0
- 运行依赖：2 个
- 首次发布：2024-01-28T17:16:48.798Z
- 最新版本发布：2026-09-11T16:01:38.367Z
- 近 30 天下载量：24135（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：40（近 12 个月 6 个）

## 中文简介

克罗纳斯

## 安装

```sh
npm install @chronus/github-pr-commenter
```

也可以使用：`pnpm add @chronus/github-pr-commenter`、`yarn add @chronus/github-pr-commenter`、`bun add @chronus/github-pr-commenter`

## README

# Chronus github pr 注释器

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

这必须用在 github 描述的 2 个步骤中 [这里](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)。 。 。 .

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

```yaml
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 注释的工作流程

```yaml
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 是什么？

克罗纳斯

### 如何安装 @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 和提交记录判断。

