Skip to content

chore: add pkg.pr.new #909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

chore: add pkg.pr.new #909

wants to merge 11 commits into from

Conversation

li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Jan 2, 2025

Summary by CodeRabbit

  • 持续集成
    • 新增 GitHub Actions 工作流程,自动化项目构建和发布流程
    • 支持在推送和拉取请求时触发工作流程
    • 新增依赖项 "pkg-pr-new": "^0.0.39" 用于开发环境
    • 自动编译和发布项目包

Copy link

vercel bot commented Jan 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tree ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 4, 2025 9:56pm

Copy link

coderabbitai bot commented Jan 2, 2025

概述

演练

一个新的 GitHub Actions 工作流文件 pkg.pr.new.yml 被引入。这个工作流在推送和拉取请求事件时触发,定义了一个名为 build 的作业,运行在最新版本的 Ubuntu 上。工作流包括代码检出、启用 Corepack、设置 Bun、安装依赖、构建项目和发布包等步骤。

变更

文件 变更摘要
.github/workflows/pkg.pr.new.yml 新增 GitHub Actions 工作流,自动化项目构建和发布流程
package.json 新增开发依赖 "pkg-pr-new": "^0.0.39"

诗歌

🐰 代码兔子轻轻跳,
GitHub Actions 启动了
编译构建一路通
发布流程如风飘
自动化的魔法妙!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.84%. Comparing base (8e1dd54) to head (46035f6).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #909   +/-   ##
=======================================
  Coverage   99.84%   99.84%           
=======================================
  Files          14       14           
  Lines        1275     1275           
  Branches      392      392           
=======================================
  Hits         1273     1273           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@li-jia-nan
Copy link
Member Author

奇怪,本地都 compile 成功了:

image

Copy link

@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: 3

🧹 Nitpick comments (1)
.github/workflows/pkg.pr.new.yml (1)

17-19: 优化依赖安装性能

建议添加依赖缓存以提高工作流执行速度。

在 setup-node 步骤后添加缓存配置:

      - uses: actions/setup-node@v4
        with:
          node-version: 20
+         cache: 'npm'

      - name: Install dependencies
        run: npm install
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eaf7d37 and aac0e32.

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

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None +1 586 kB stackblitz-devops

View full report↗︎

Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aac0e32 and 46035f6.

📒 Files selected for processing (2)
  • .github/workflows/pkg.pr.new.yml (1 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/pkg.pr.new.yml

[error] 14-14: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
.github/workflows/pkg.pr.new.yml (3)

1-2: 优化工作流触发器配置

工作流同时在 push 和 pull_request 事件上触发会导致重复运行。建议根据具体需求选择合适的触发条件。

name: Publish Any Commit
-on: [push, pull_request]
+on:
+  push:
+    branches:
+      - main
+      - master
+  pull_request:
+    types: [opened, synchronize]

18-20: 添加测试步骤

在编译之后、发布之前应当添加测试步骤以确保代码质量。

      - name: Build
        run: npm run compile

+     - name: Test
+       run: npm test

21-21: ⚠️ Potential issue

配置发布认证

当前发布步骤缺少必要的 NPM 认证配置,这可能导致发布失败。同时建议限制发布条件,只在特定情况下执行发布操作。

+     - name: Configure npm
+       run: |
+         echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
+
-      - run: bunx pkg-pr-new publish
+      - name: Publish
+       if: startsWith(github.ref, 'refs/tags/v')
+       run: npm publish
+       env:
+         NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Likely invalid or redundant comment.

package.json (1)

73-73: 评估发布工具的必要性

注意到以下几点:

  1. package.json 中已经配置了 prepublishOnly 脚本,使用 np 进行发布管理
  2. 新添加的 pkg-pr-new 依赖版本为 0.0.39,属于早期开发版本
  3. 两种发布方式可能产生冲突

建议:

  1. 评估是否确实需要更换发布工具
  2. 如果确定使用 pkg-pr-new,建议移除现有的 np 相关配置
  3. 考虑使用更稳定的发布工具版本
-    "pkg-pr-new": "^0.0.39",
✅ Verification successful

Let me gather more information about the publishing configuration and dependencies.


确认发现发布配置冲突

经验证,代码库中确实存在发布工具配置冲突:

  • 现有配置使用 np (v10.0.5) 作为发布工具,且已在 prepublishOnly 脚本中配置
  • 新添加的 pkg-pr-new (v0.0.39) 为早期开发版本
  • 两个发布工具并存可能导致发布流程混乱

建议:

  • 移除 pkg-pr-new 依赖,继续使用当前稳定的 np 发布工具
  • 如确实需要更换发布工具,应先移除 np 相关配置,并详细说明更换原因
🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Check package.json for publishing related configurations and dependencies
cat package.json | jq '.scripts + {dependencies: .dependencies, devDependencies: .devDependencies}'

Length of output: 1645

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