Conversation
|
To prevent beginners from mistakenly submitting PRs, |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (workflow_dispatch)
participant GH as GitHub Actions (download_dispatch)
participant Job as crawler job (env)
participant Py as usage/workflow_download.py
participant Plugin as Img2pdfPlugin
User->>GH: trigger download_dispatch with PDF_NAME_RULE
GH->>Job: start crawler job (env.PDF_NAME_RULE set)
Job->>Py: run script (reads env.PDF_NAME_RULE)
Py->>Py: compute pdf_name_rule (trim or fallback templates)
Py->>Plugin: initialize with filename_rule=pdf_name_rule
Plugin-->>Py: generate PDF(s)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/download_dispatch.yml (1)
43-47: 建议补充规则格式示例,降低误填概率Line [45] 目前只列了字段名,建议直接给可复制的模板示例(含
{})以减少无效规则输入。✏️ Suggested wording
- description: 'PDF文件命名规则。支持字段如 Aid, Atitle, Pindex, Pid, Ptitle' + description: 'PDF文件命名规则(示例:[JM{Aid}] {Atitle} 或 [JM{Aid}] 第{Pindex}章-JM{Pid}-{Ptitle})。支持字段 Aid, Atitle, Pindex, Pid, Ptitle'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/download_dispatch.yml around lines 43 - 47, Update the PDF_NAME_RULE parameter description to include a concrete, copy-pasteable template example using braces (e.g. include a template like {Aid}-{Atitle}-{Pindex} in the description) so users can see exact placeholder syntax; modify the description string for PDF_NAME_RULE to show one or two example templates and note supported fields (Aid, Atitle, Pindex, Pid, Ptitle) and that braces are required around field names.
🤖 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/close_specific_pr.yml:
- Around line 31-33: The grep pattern that checks PR_TITLE (the line using echo
"$PR_TITLE" | grep -Ei "feat:|fix:") is too narrow and misses Conventional
Commit variants like scoped or breaking-change forms; update the grep invocation
to use a regex that matches (^|[[:space:]])(feat|fix)(\([^)]+\))?(!)?: so
PR_TITLE recognizes feat/scope, fix/scope, and ! breaking-change tokens and thus
correctly skips auto-closing for those PRs.
In `@usage/workflow_download.py`:
- Around line 88-91: The code treats pdf_name_rule as configured when it
contains only whitespace; update the check around env('PDF_NAME_RULE', None) and
pdf_name_rule so you normalize/strip the value first (e.g., read pdf_name_rule =
env('PDF_NAME_RULE', None), then if pdf_name_rule is not None: pdf_name_rule =
pdf_name_rule.strip() and only consider it set if non-empty), and fall back to
the default rule based on call_when when the stripped value is empty; refer to
the pdf_name_rule variable, the env(...) call, and call_when to locate and
implement the change.
---
Nitpick comments:
In @.github/workflows/download_dispatch.yml:
- Around line 43-47: Update the PDF_NAME_RULE parameter description to include a
concrete, copy-pasteable template example using braces (e.g. include a template
like {Aid}-{Atitle}-{Pindex} in the description) so users can see exact
placeholder syntax; modify the description string for PDF_NAME_RULE to show one
or two example templates and note supported fields (Aid, Atitle, Pindex, Pid,
Ptitle) and that braces are required around field names.
🪄 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: 9df8617c-b0cf-4586-ad4d-ea9b573a2b12
📒 Files selected for processing (3)
.github/workflows/close_specific_pr.yml.github/workflows/download_dispatch.ymlusage/workflow_download.py
原来使用简单的 `Aid` 或 `Pid` 进行命名,用户反馈导出的 PDF 名字全是数字看不出是什么。现在: 1. 默认情况下,本子维度的 PDF 命名为 `Atitle`,章节维度的 PDF 命名为 `Atitle_Ptitle`。 2. 新增可选的环境变量和 Action 面板输入参数 `PDF_NAME_RULE`,允许用户自定义生成规则。
597b384 to
c882941
Compare
此次 PR 旨在解决用户反馈的 PDF 文件名难以辨认以及自动关闭逻辑误伤开发 PR 的问题。
主要改动:
[JM{Aid}] {Atitle},包含项目前缀、ID 和本子标题。[JM{Aid}] 第{Pindex}章-JM{Pid}-{Ptitle},提供详细的层级信息。download_dispatch.yml中新增PDF_NAME_RULE选项,支持用户根据需求自定义命名规则。close_specific_pr.yml误伤逻辑:feat:或fix:,则会自动跳过关闭逻辑,允许有意义的特性或修复 PR 正常开启。关联 Issue: #91
Summary by CodeRabbit
New Features
Chores