fix: claude ワークフローの bot 自己トリガーループを防止 - #642
Conversation
- bot フィルタ sender.type != 'Bot' を追加(全 bot 一括除外) - concurrency group に comment.id/review.id を追加 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR updates two GitHub Actions workflows to improve bot filtering and concurrency management. The bot exclusion logic changes from checking specific bot actor names to using a generic sender type check. Additionally, the claude workflow's concurrency grouping is refined to include comment and review IDs for better granularity. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14a9be3959
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| permissions: {} | ||
|
|
||
| concurrency: | ||
| <<<<<<< Updated upstream |
There was a problem hiding this comment.
Remove unresolved conflict markers from workflow
This commit leaves Git conflict markers (for example <<<<<<< Updated upstream) in claude.yml, which makes the workflow file invalid YAML. In this state, GitHub Actions cannot parse the workflow, so the Claude Code automation will fail to trigger on all configured events until the markers are removed and one branch of the conflict is resolved.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/claude-code-review.yml (1)
123-123: Add bot guard tocheck-ci-statusjob to prevent wasted runner time.Line 23 allows bot-triggered PRs to enter the CI polling loop, while line 123 skips
claude-reviewfor bots. This creates inefficient behavior where bot PRs consume 20 minutes of runner time before the workflow exits. Mirror the bot guard from line 123 to line 23 to skipcheck-ci-statusentirely for bot-generated pull requests.♻️ Proposed change
check-ci-status: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && github.event.sender.type != 'Bot'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/claude-code-review.yml at line 123, The check-ci-status job's if condition currently allows bot-triggered PRs into the CI polling loop; update the job-level if condition for the check-ci-status job (the line starting with "if: github.event.pull_request.draft == false && needs.check-ci-status.outputs.ci_passed == 'true'") to include the same bot guard used for claude-review by adding "&& github.event.sender.type != 'Bot'". This ensures the check-ci-status job skips entirely for bot-generated pull requests and prevents wasting runner time.
🤖 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/claude.yml:
- Around line 16-31: The workflow contains unresolved git conflict markers
(<<<<<<<, =======, >>>>>>>) around the group declaration which breaks YAML
parsing; remove those markers and replace the simple group line with the
stashed-expanded version that builds the group key using the folded block (>-)
and includes the comment/review IDs, i.e. keep the group declaration that
references github.event.issue.number || github.event.pull_request.number ||
github.run_id and appends github.event.comment.id || github.event.review.id ||
github.run_id, preserving the indentation and folded-block syntax so the final
YAML has a single valid group: entry without any conflict markers.
---
Nitpick comments:
In @.github/workflows/claude-code-review.yml:
- Line 123: The check-ci-status job's if condition currently allows
bot-triggered PRs into the CI polling loop; update the job-level if condition
for the check-ci-status job (the line starting with "if:
github.event.pull_request.draft == false &&
needs.check-ci-status.outputs.ci_passed == 'true'") to include the same bot
guard used for claude-review by adding "&& github.event.sender.type != 'Bot'".
This ensures the check-ci-status job skips entirely for bot-generated pull
requests and prevents wasting runner time.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 236659a1-c402-49fa-b213-072d56aa813f
📒 Files selected for processing (2)
.github/workflows/claude-code-review.yml.github/workflows/claude.yml
| <<<<<<< Updated upstream | ||
| group: claude-${{ github.repository }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }} | ||
| ======= | ||
| # イベント種別 + トリガーのコメント/レビューIDを含めることで、 | ||
| # 同一 PR/Issue 内でも異なるメンションが互いをキャンセルしない | ||
| group: >- | ||
| claude-${{ github.repository }}-${{ | ||
| github.event.issue.number | ||
| || github.event.pull_request.number | ||
| || github.run_id | ||
| }}-${{ | ||
| github.event.comment.id | ||
| || github.event.review.id | ||
| || github.run_id | ||
| }} | ||
| >>>>>>> Stashed changes |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n '^(<<<<<<<|=======|>>>>>>>)' .github/workflows/claude.ymlRepository: keito4/config
Length of output: 1772
Resolve merge-conflict markers to restore workflow validity.
The file contains unresolved merge-conflict markers at lines 16-31 and 38-44 that make the YAML invalid. YAMLlint cannot parse Line 17 due to the syntax errors introduced by these markers. Remove the markers and keep the stashed changes as shown below:
Suggested resolution
concurrency:
-<<<<<<< Updated upstream
- group: claude-${{ github.repository }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }}
-=======
# イベント種別 + トリガーのコメント/レビューIDを含めることで、
# 同一 PR/Issue 内でも異なるメンションが互いをキャンセルしない
group: >-
claude-${{ github.repository }}-${{
github.event.issue.number
|| github.event.pull_request.number
|| github.run_id
}}-${{
github.event.comment.id
|| github.event.review.id
|| github.run_id
}}
->>>>>>> Stashed changes
cancel-in-progress: false claude:
# Bot 全般を除外(sender.type で判定するため、Bot 名のハードコードが不要)
if: |
-<<<<<<< Updated upstream
- github.actor != 'github-actions[bot]' &&
- github.actor != 'dependabot[bot]' &&
- github.actor != 'claude[bot]' &&
-=======
github.event.sender.type != 'Bot' &&
->>>>>>> Stashed changes
(📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <<<<<<< Updated upstream | |
| group: claude-${{ github.repository }}-${{ github.event.issue.number || github.event.pull_request.number || github.run_id }} | |
| ======= | |
| # イベント種別 + トリガーのコメント/レビューIDを含めることで、 | |
| # 同一 PR/Issue 内でも異なるメンションが互いをキャンセルしない | |
| group: >- | |
| claude-${{ github.repository }}-${{ | |
| github.event.issue.number | |
| || github.event.pull_request.number | |
| || github.run_id | |
| }}-${{ | |
| github.event.comment.id | |
| || github.event.review.id | |
| || github.run_id | |
| }} | |
| >>>>>>> Stashed changes | |
| concurrency: | |
| # イベント種別 + トリガーのコメント/レビューIDを含めることで、 | |
| # 同一 PR/Issue 内でも異なるメンションが互いをキャンセルしない | |
| group: >- | |
| claude-${{ github.repository }}-${{ | |
| github.event.issue.number | |
| || github.event.pull_request.number | |
| || github.run_id | |
| }}-${{ | |
| github.event.comment.id | |
| || github.event.review.id | |
| || github.run_id | |
| }} | |
| cancel-in-progress: false |
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 17-17: syntax error: could not find expected ':'
(syntax)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/claude.yml around lines 16 - 31, The workflow contains
unresolved git conflict markers (<<<<<<<, =======, >>>>>>>) around the group
declaration which breaks YAML parsing; remove those markers and replace the
simple group line with the stashed-expanded version that builds the group key
using the folded block (>-) and includes the comment/review IDs, i.e. keep the
group declaration that references github.event.issue.number ||
github.event.pull_request.number || github.run_id and appends
github.event.comment.id || github.event.review.id || github.run_id, preserving
the indentation and folded-block syntax so the final YAML has a single valid
group: entry without any conflict markers.
|
🎉 This PR is included in version 1.107.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
github.event.sender.type != 'Bot'を追加(全 Bot 一括除外)comment.id/review.idを追加Test plan
@claudeメンションで正常に起動することを確認🤖 Generated with Claude Code
Summary by CodeRabbit