ci(workflows): fix pnpm installation and improve issue tracker (#12388)

* ci(workflows): add pnpm caching to improve build performance

Cache pnpm dependencies to reduce installation time in CI workflows

* ci(github-actions): change claude-code-action version to v1

* ci(workflows): improve issue tracker formatting

Format issue body as markdown code block for better readability in workflow output

* ci(workflows): unify claude-code-action version to v1 for both jobs

Changed process-pending-issues job from @main to @v1 to maintain consistency across all jobs and avoid potential version conflicts.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(workflows): remove --help from allowed-tools to avoid upstream parsing bug

The `--help` flags in claude_args were being incorrectly parsed as actual
command-line arguments by claude-code-action, causing JSON parsing errors
("Unexpected identifier 'Usage'").

Switched to wildcard pattern `pnpm tsx scripts/feishu-notify.ts*` which:
- Allows all feishu-notify.ts commands including --help
- Avoids triggering the upstream argument parsing bug
- Simplifies the allowed-tools configuration

This addresses the root cause identified by Anthropic engineers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(workflows): remove --help references from prompts

Remove `--help` references from prompts to avoid potential parsing issues.
The example commands are already comprehensive enough without needing to
mention the help flag.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Phantom 2026-01-09 20:47:39 +08:00 committed by GitHub
parent c5ea42ca3a
commit 864eda68fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,12 +80,12 @@ jobs:
- name: Process issue with Claude
if: steps.check_time.outputs.should_delay == 'false'
uses: anthropics/claude-code-action@main
uses: anthropics/claude-code-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
allowed_non_write_users: "*"
anthropic_api_key: ${{ secrets.CLAUDE_TRANSLATOR_APIKEY }}
claude_args: "--allowed-tools Bash(gh issue:*),Bash(pnpm tsx scripts/feishu-notify.ts issue:*),Bash(pnpm tsx scripts/feishu-notify.ts --help),Bash(pnpm tsx scripts/feishu-notify.ts issue --help)"
claude_args: "--allowed-tools Bash(gh issue:*),Bash(pnpm tsx scripts/feishu-notify.ts*)"
prompt: |
你是一个GitHub Issue自动化处理助手。请完成以下任务
@ -94,9 +94,14 @@ jobs:
- 标题:${{ github.event.issue.title }}
- 作者:${{ github.event.issue.user.login }}
- URL${{ github.event.issue.html_url }}
- 内容:${{ github.event.issue.body }}
- 标签:${{ join(github.event.issue.labels.*.name, ', ') }}
### Issue body
`````md
${{ github.event.issue.body }}
`````
## 任务步骤
1. **分析并总结issue**
@ -106,8 +111,7 @@ jobs:
- 重要的技术细节
2. **发送飞书通知**
使用CLI工具发送飞书通知运行 `pnpm tsx scripts/feishu-notify.ts issue --help` 查看参数说明。
示例:
使用CLI工具发送飞书通知参考以下示例
```bash
pnpm tsx scripts/feishu-notify.ts issue \
-u "${{ github.event.issue.html_url }}" \
@ -146,16 +150,32 @@ jobs:
with:
node-version: 22
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install
- name: Process pending issues with Claude
uses: anthropics/claude-code-action@main
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.CLAUDE_TRANSLATOR_APIKEY }}
allowed_non_write_users: "*"
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_args: "--allowed-tools Bash(gh issue:*),Bash(gh api:*),Bash(pnpm tsx scripts/feishu-notify.ts issue:*),Bash(pnpm tsx scripts/feishu-notify.ts --help),Bash(pnpm tsx scripts/feishu-notify.ts issue --help)"
claude_args: "--allowed-tools Bash(gh issue:*),Bash(gh api:*),Bash(pnpm tsx scripts/feishu-notify.ts*)"
prompt: |
你是一个GitHub Issue自动化处理助手。请完成以下任务
@ -177,8 +197,7 @@ jobs:
- 重要的技术细节
3. **发送飞书通知**
使用CLI工具发送飞书通知运行 `pnpm tsx scripts/feishu-notify.ts issue --help` 查看参数说明。
示例:
使用CLI工具发送飞书通知参考以下示例
```bash
pnpm tsx scripts/feishu-notify.ts issue \
-u "<issue的html_url>" \