Skip to content

fix: handle CI workflow skip by path filters - #275

Merged
keito4 merged 1 commit into
mainfrom
fix/handle-ci-path-filters-skip
Jan 2, 2026
Merged

fix: handle CI workflow skip by path filters#275
keito4 merged 1 commit into
mainfrom
fix/handle-ci-path-filters-skip

Conversation

@keito4

@keito4 keito4 commented Jan 2, 2026

Copy link
Copy Markdown
Owner

Summary

claude-code-review workflow now properly handles cases where CI is skipped by path filters, preventing unnecessary 15-minute timeouts for documentation-only PRs.

Problem

PR #274 revealed a critical issue:

  1. Documentation-only changes: .claude/devcontainer-recommendations.md
  2. CI workflow path filters: Don't include .md files
  3. Result: CI workflow not triggered, Quality Gate never appears
  4. check-ci-status behavior: Waits 15 minutes for Quality Gate, then times out
  5. Impact: claude-review never runs for doc-only PRs

Solution

Added intelligent detection for path filter skips:

Detection Logic

After 2 minutes (120s) of waiting:

  1. Check if Quality Gate exists
  2. Check if Detect Changes job exists
  3. If both are missing → CI skipped by path filters
  4. Set ci_passed=true to allow review to proceed

Behavior Matrix

PR Type CI Triggered Behavior
Code changes ✅ Yes Waits for CI, validates Quality Gate
Doc-only changes ❌ No Detects skip after 2min, proceeds with review
Mixed changes ✅ Yes Waits for CI, validates Quality Gate

Status Messages

CI Running:

⏳ Quality Gate is still running: in_progress, waiting...
⏱️  Elapsed time: 30s / 900s
✅ All CI checks passed

CI Skipped by Path Filters:

⏱️  Elapsed time: 120s / 900s
✅ CI workflow skipped by path filters (no code changes detected)
Claude Code Review will proceed without waiting for CI.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • CI/CD changes

Impact

Before

  • Doc-only PRs wait 15 minutes → timeout → no review
  • Wastes GitHub Actions minutes
  • Poor user experience

After

  • Doc-only PRs wait 2 minutes → proceed with review
  • Code PRs still validate CI properly
  • Optimal balance between safety and efficiency

Testing

This PR will test the detection logic:

  1. If CI runs → validates polling works
  2. If CI skips → validates skip detection works

Expected for PR #274:

  1. check-ci-status detects CI skip after 2 minutes
  2. Sets ci_passed=true
  3. claude-review runs successfully

Related Issues

Fixes the timeout issue discovered in #274


🤖 Generated with Claude Code

## Problem

When PRs contain only documentation changes (e.g., `.md` files), the CI
workflow is not triggered due to path filters. This causes check-ci-status
to wait indefinitely for Quality Gate, eventually timing out after 15 minutes.

### Example: PR #274
- Changes: `.claude/devcontainer-recommendations.md`
- CI workflow: Not triggered (path filters exclude `.md`)
- check-ci-status: Waits for Quality Gate that never appears
- Result: Times out after 900s, claude-review never runs

## Solution

Added logic to detect when CI is skipped by path filters:

### Detection Logic
1. After 2 minutes (120s) of waiting
2. If Quality Gate hasn't appeared
3. Check if Detect Changes job exists
4. If both are missing → CI skipped by path filters
5. Set `ci_passed=true` to allow claude-review to proceed

### Behavior

**Code changes** (CI runs):
- Waits for Quality Gate completion
- Validates all checks passed
- Runs claude-review after CI success

**Documentation-only changes** (CI skipped):
- Detects no CI after 2 minutes
- Allows claude-review to proceed immediately
- No unnecessary 15-minute wait

### Status Messages
- ✅ CI workflow skipped by path filters (no code changes detected)
- Claude Code Review will proceed without waiting for CI

## Impact

- PR #274 and similar doc-only PRs will get claude-review
- No more 15-minute timeouts for non-code changes
- Maintains CI validation for code changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

coderabbitai Bot commented Jan 2, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@keito4 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8b4a8b5 and b8aa3d1.

📒 Files selected for processing (1)
  • .github/workflows/claude-code-review.yml

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:30:34: Double quote to prevent globbing and word splitting [shellcheck]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:54:31: Double quote to prevent globbing and word splitting [shellcheck]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:64:31: Double quote to prevent globbing and word splitting [shellcheck]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:72:28: Double quote to prevent globbing and word splitting [shellcheck]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [actionlint] reported by reviewdog 🐶
shellcheck reported issue in this script: SC2086:info:78:27: Double quote to prevent globbing and word splitting [shellcheck]

@keito4
keito4 merged commit 3e308f3 into main Jan 2, 2026
11 checks passed
@claude

claude Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

Code Review - PR #275

概要

ドキュメント専用PRでCI workflowがpath filtersによってスキップされる場合に、不要な15分のタイムアウトを防ぐための改善です。良い問題の特定と適切な解決策です。


✅ 良い点

  1. 問題の正確な特定 - PR #274の実際の問題を的確に捉えている
  2. 適切な待機時間 - 2分(120秒)は妥当な設定
  3. 明確な検出ロジック - Quality GateとDetect Changesの両方の不在をチェック
  4. わかりやすいメッセージ - ユーザーフレンドリーな出力

🔍 潜在的な問題

1. Critical: シェルスクリプトのロジックエラー ⚠️

問題箇所: .github/workflows/claude-code-review.yml:58-68

Detect Changesが存在する場合(コード変更あり)でも、Quality Gateが来ない場合に15分タイムアウトまで待つことになります。

推奨修正: else節を追加して警告を出力

2. jqのパイプライン処理

CHECK_RUNSは複数のJSONオブジェクト形式なので、jq -s でslurp modeを使用すべきです。

3. エッジケース: CI workflowの遅延起動

GitHub Actionsのqueueが混雑時、2分経過時点でDetect Changesが未開始の可能性があります。


📊 評価

項目 評価
問題の特定 ⭐⭐⭐⭐⭐
解決策の妥当性 ⭐⭐⭐⭐
コード品質 ⭐⭐⭐
テストカバレッジ ⭐⭐

総合: ⭐⭐⭐⭐ (4/5)


📝 推奨アクション

必須

  1. シェルスクリプトのロジック改善 - else節を追加
  2. jqクエリの堅牢化 - slurp modeを使用

推奨

  1. 待機時間の調整検討
  2. テストの追加

詳細なレビューコメントは別途提供します。


レビュー実施: Claude Sonnet 4.5

@claude

claude Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

詳細レビュー - 技術的な改善提案

1. シェルスクリプトのロジック改善

現在の実装では、Detect Changesが存在する場合の処理が明示されていません。

推奨: else節を追加して、異常状態を検出・警告する

2. jqクエリの堅牢化

現在のjq selectは最初のマッチのみ返します。複数の同名check runs対応のため、slurp mode使用を推奨:

jq -s 'map(select(.name == "Quality Gate")) | .[-1] // empty'

3. CI queue遅延への対応

2分待機でも稀にCI未開始の可能性があります。Workflow runs APIで直接確認する方法を追加検討。

4. テストカバレッジ

CLAUDE.mdでは70%+カバレッジが要求されています。test-act.ymlでの統合テスト追加を推奨。

5. セキュリティ・パフォーマンス

✅ セキュリティ: 問題なし
✅ パフォーマンス: 改善(15分→2分)
✅ コスト削減: GitHub Actions実行時間短縮

まとめ

良い改善ですが、特に1と2の修正を適用することで、より堅牢な実装になります。

@claude

claude Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

コード修正例

推奨修正1: else節の追加

現在のコード(58-68行目)に以下のelse節を追加することで、Detect Changesが存在するのにQuality Gateが来ない異常状態を検出できます。

推奨修正2: jqクエリの改善

56行目と61行目のjqコマンドを変更:

Before:

  • jq -r select を使用(最初のマッチのみ)

After:

  • jq -s を使用(slurp mode、全入力を配列化)
  • map と .[-1] で最新の要素を取得
  • // empty で空配列の場合の処理を明確化

メリット:

  • 複数の同名check runsがある場合(再実行など)に最新のものを取得
  • 空の場合の処理が明確
  • より堅牢なエラーハンドリング

その他の推奨事項

テストの追加:

  • .github/workflows/test-act.yml に統合テストを追加
  • ドキュメント専用PRとコード変更PRの両方のシナリオをテスト

モニタリング:

  • どのくらいの頻度でpath filter skipが発生するか計測
  • 2分の待機時間が適切か実データで検証

これらの修正により、エッジケースでの動作が大幅に改善されます。

@claude

claude Bot commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

レビューサマリー

PR #275のレビューを完了しました。

総合評価: ⭐⭐⭐⭐ (4/5)

良い点:

  • 問題の特定が的確(ドキュメント専用PRのタイムアウト)
  • 解決策が適切(2分後にpath filter skipを検出)
  • PR descriptionが非常に詳細
  • パフォーマンス改善(15分→2分)

改善推奨:

  1. Critical: シェルスクリプトにelse節を追加(異常状態検出)
  2. Critical: jqクエリをslurp modeに変更(複数check runs対応)
  3. 推奨: 統合テストの追加
  4. 推奨: CI queue遅延への対応検討

次のステップ

上記のCritical項目(1と2)の修正を適用することを強く推奨します。これらは小さな変更ですが、エッジケースでの堅牢性が大幅に向上します。

修正後、このPRはマージ可能な状態になると考えます。


詳細は上記のコメントを参照してください。質問があればお気軽にどうぞ。

レビュー実施: Claude Sonnet 4.5 @ 2025-01-02

@keito4
keito4 deleted the fix/handle-ci-path-filters-skip branch January 29, 2026 00:52
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.

1 participant