Skip to content

fix: required status checks を実際の CI ジョブ名に合わせる - #581

Merged
keito4 merged 2 commits into
mainfrom
fix/required-status-checks-alignment
Mar 15, 2026
Merged

fix: required status checks を実際の CI ジョブ名に合わせる#581
keito4 merged 2 commits into
mainfrom
fix/required-status-checks-alignment

Conversation

@keito4

@keito4 keito4 commented Mar 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • setup-team-protection.sh の required status checks を "CI""Quality Gate" に修正。Quality Gate ジョブは if: always() で常に実行され全チェックを集約するため、paths フィルタでスキップされても "Waiting for status" にならない
  • Next.js プロジェクト向けに pre-production / production ブランチの保護を推奨設定として追加
  • repo-maintenance の必須ジョブ参照を Quality Gate ベースに更新

Test plan

  • setup-team-protection.sh --dry-runQuality Gate が contexts に含まれることを確認
  • Next.js プロジェクトで /repo-maintenance 実行時に pre-production/production の保護が提案されることを確認
  • PR の required status checks が実際の CI ジョブ名と一致し、"Waiting for status" にならないことを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Automatic framework detection for Next.js configures stricter branch protection for main, pre-production, and production.
  • Documentation

    • Added framework-specific branch protection guidance and expanded best-practice/emergency procedures.
    • Updated CI/CD status check wording to reference a "Quality Gate" aggregation.
  • Tests

    • Added skip patterns to a workflow test to exclude specified workflows from a checkout-action check.

- setup-team-protection.sh の contexts を "CI" → "Quality Gate" に変更
  Quality Gate ジョブが全チェックを集約し if: always() で常に実行されるため最適
- Next.js プロジェクト向けに pre-production/production ブランチの保護を推奨に追加
- repo-maintenance の必須ジョブ参照を Quality Gate ベースに更新

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the bug 不具合・バグ label Mar 15, 2026
@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f5c4838d-aae1-4a8c-b98b-dd279d59a50d

📥 Commits

Reviewing files that changed from the base of the PR and between 8a8ba80 and 88f071d.

📒 Files selected for processing (1)
  • test/integration/workflows.bats

📝 Walkthrough

Walkthrough

Adds framework-aware branch protection that detects Next.js projects and applies strict protection to main, pre-production, and production; replaces required status check label "CI" with "Quality Gate" across docs and setup scripts; small test update to skip specified workflows.

Changes

Cohort / File(s) Summary
Branch protection docs
.claude/commands/repo-maintenance.md, .claude/commands/setup-team-protection.md
Added Next.js detection and recommended protected branches (main, pre-production, production); changed required status check text from CI to Quality Gate; expanded guidance (team-size, emergency procedures, examples).
Setup script
script/setup-team-protection.sh
Switched required status-check context from "CI" to "Quality Gate" in branch protection API call; added comment explaining Quality Gate aggregates CI jobs; integrated framework-aware branch selection logic.
Tests
test/integration/workflows.bats
Added skip mechanism to exclude workflows by basename when verifying use of actions/checkout in workflow jobs.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(200,200,255,0.5)
    participant CLI as CLI
    participant Script as setup-team-protection.sh
    participant GitHub as GitHub API
    participant Repo as Repository
  end
  CLI->>Script: run protection setup (repo, options)
  Script->>Repo: read package.json
  alt Next.js detected
    Script->>Script: set PROTECT_BRANCHES = main,pre-production,production\nset PROTECTION_LEVEL = strict
  else Not Next.js
    Script->>Script: set PROTECT_BRANCHES = main\nset PROTECTION_LEVEL = standard
  end
  Script->>GitHub: call Branch Protection API\n(required_check: "Quality Gate")
  GitHub-->>Script: confirmation
  Script-->>CLI: report result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size/S

Poem

🐇 I sniff the package.json bright,
Next.js found — I hop with delight.
Quality Gate rings the bell,
Main and prod now guarded well,
A rabbit cheers: safe branches tonight!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating required status checks from 'CI' to 'Quality Gate' to align with actual CI job names.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/required-status-checks-alignment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@keito4

keito4 commented Mar 15, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項なし。

補足:

  • テスト実行はしていません。

判定: patch is correct
理由: 変更は Quality Gate 必須チェックへの統一とドキュメント整合が主で、リポジトリ内に Quality Gate ジョブが存在するためブランチ保護の必須チェック名変更による破綻は見当たりません。
信頼度: 0.66


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented Mar 15, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

指摘事項

  • 必須ステータスチェック名が実際のチェック名と一致しない可能性が高い。CI ワークフロー名が CI のため、GitHub のチェック名は通常 CI / Quality Gate になります。"Quality Gate" を required check に設定すると一致せず、マージが恒久的にブロックされる恐れがあります。script/setup-team-protection.sh:233-238

補足: 同じ誤りが手順書にもあり、運用時に誤設定を誘発します。.claude/commands/setup-team-protection.md:82-86

Overall
patch is incorrect — 必須チェック名の不一致によりブランチ保護が機能せず、CI が通っていてもマージ不能になるリスクが高いです。信頼度 0.62


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented Mar 15, 2026

Copy link
Copy Markdown
Owner Author

(aside)
@claude PRがbaseにマージする際にCIが落ちています。
修正してください。

@claude

claude Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/commands/repo-maintenance.md:
- Around line 287-306: The doc's framework-detection sets
PROTECT_BRANCHES/PROTECTION_LEVEL but the target script
script/setup-team-protection.sh expects CLI args --branches and
--protection-level; update the example to invoke that script and pass the
computed values as CLI arguments (use the IS_NEXTJS logic to compute values,
then call script/setup-team-protection.sh with --branches set to the
PROTECT_BRANCHES value and --protection-level set to the PROTECTION_LEVEL
value), or alternatively modify script/setup-team-protection.sh to accept
fallback environment variables PROTECT_BRANCHES and PROTECTION_LEVEL when those
CLI flags are not provided.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 33f10141-4e50-40a9-8d64-16ad5069fb50

📥 Commits

Reviewing files that changed from the base of the PR and between bc67fbd and 8a8ba80.

📒 Files selected for processing (3)
  • .claude/commands/repo-maintenance.md
  • .claude/commands/setup-team-protection.md
  • script/setup-team-protection.sh

Comment on lines +287 to +306
**フレームワーク検出による保護ブランチの自動判定:**

```bash
# Next.js プロジェクトかどうかを検出
IS_NEXTJS=false
if [ -f "package.json" ]; then
if jq -e '.dependencies.next // .devDependencies.next' package.json &>/dev/null; then
IS_NEXTJS=true
fi
fi

# Next.js の場合は pre-production / production も保護対象
if [ "$IS_NEXTJS" = true ]; then
PROTECT_BRANCHES="main,pre-production,production"
PROTECTION_LEVEL="strict"
else
PROTECT_BRANCHES="main"
PROTECTION_LEVEL="standard"
fi
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if setup-team-protection.sh reads PROTECT_BRANCHES or PROTECTION_LEVEL env vars
rg -n 'PROTECT_BRANCHES|:-\$\{?PROTECT|:-\$\{?PROTECTION_LEVEL' script/setup-team-protection.sh || echo "No env var reads found - confirms the issue"

Repository: keito4/config

Length of output: 100


🏁 Script executed:

rg -n '\-\-branches|\-\-protection-level' script/setup-team-protection.sh | head -20

Repository: keito4/config

Length of output: 277


Environment variables are not read by the target script.

The framework detection logic sets PROTECT_BRANCHES and PROTECTION_LEVEL as environment variables, but script/setup-team-protection.sh does not read these. The script only accepts --branches and --protection-level as CLI arguments (lines 64 and 80 of the script).

Either:

  1. Update this command doc to pass CLI arguments instead of setting env vars, or
  2. Update the script to fallback to environment variables
Option 1: Use CLI arguments (recommended)
 # Next.js プロジェクトかどうかを検出
 IS_NEXTJS=false
 if [ -f "package.json" ]; then
   if jq -e '.dependencies.next // .devDependencies.next' package.json &>/dev/null; then
     IS_NEXTJS=true
   fi
 fi

 # Next.js の場合は pre-production / production も保護対象
 if [ "$IS_NEXTJS" = true ]; then
-  PROTECT_BRANCHES="main,pre-production,production"
-  PROTECTION_LEVEL="strict"
+  bash script/setup-team-protection.sh \
+    --branches main,pre-production,production \
+    --create-branches \
+    --protection-level strict
 else
-  PROTECT_BRANCHES="main"
-  PROTECTION_LEVEL="standard"
+  bash script/setup-team-protection.sh \
+    --branches main \
+    --protection-level standard
 fi
📝 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.

Suggested change
**フレームワーク検出による保護ブランチの自動判定:**
```bash
# Next.js プロジェクトかどうかを検出
IS_NEXTJS=false
if [ -f "package.json" ]; then
if jq -e '.dependencies.next // .devDependencies.next' package.json &>/dev/null; then
IS_NEXTJS=true
fi
fi
# Next.js の場合は pre-production / production も保護対象
if [ "$IS_NEXTJS" = true ]; then
PROTECT_BRANCHES="main,pre-production,production"
PROTECTION_LEVEL="strict"
else
PROTECT_BRANCHES="main"
PROTECTION_LEVEL="standard"
fi
```
# Next.js プロジェクトかどうかを検出
IS_NEXTJS=false
if [ -f "package.json" ]; then
if jq -e '.dependencies.next // .devDependencies.next' package.json &>/dev/null; then
IS_NEXTJS=true
fi
fi
# Next.js の場合は pre-production / production も保護対象
if [ "$IS_NEXTJS" = true ]; then
bash script/setup-team-protection.sh \
--branches main,pre-production,production \
--create-branches \
--protection-level strict
else
bash script/setup-team-protection.sh \
--branches main \
--protection-level standard
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/repo-maintenance.md around lines 287 - 306, The doc's
framework-detection sets PROTECT_BRANCHES/PROTECTION_LEVEL but the target script
script/setup-team-protection.sh expects CLI args --branches and
--protection-level; update the example to invoke that script and pass the
computed values as CLI arguments (use the IS_NEXTJS logic to compute values,
then call script/setup-team-protection.sh with --branches set to the
PROTECT_BRANCHES value and --protection-level set to the PROTECTION_LEVEL
value), or alternatively modify script/setup-team-protection.sh to accept
fallback environment variables PROTECT_BRANCHES and PROTECTION_LEVEL when those
CLI flags are not provided.

dependabot-auto-merge.yml と release-drafter.yml はリポジトリの
チェックアウトが不要なため、checkout action のチェックから除外

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@keito4
keito4 merged commit 13ffe52 into main Mar 15, 2026
16 checks passed
@keito4
keito4 deleted the fix/required-status-checks-alignment branch March 15, 2026 12:14
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.97.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 不具合・バグ released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant