Skip to content

fix(ci): Claude生成PRをリポジトリ担当者へ自動アサイン - #1049

Merged
keito4 merged 3 commits into
mainfrom
agent/claude-pr-auto-assignee
Aug 2, 2026
Merged

fix(ci): Claude生成PRをリポジトリ担当者へ自動アサイン#1049
keito4 merged 3 commits into
mainfrom
agent/claude-pr-auto-assignee

Conversation

@keito4

@keito4 keito4 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

変更内容

  • CLAUDE_PR_ASSIGNEE リポジトリ変数をClaude生成PRへ自動設定
  • 未設定時は従来どおりassigneeなしで作成
  • 実ワークフローと配布テンプレートを同期
  • 契約テストを追加

背景

OYKOT-jp配下でClaude生成PRがassigneeなしのまま滞留していました。リポジトリごとの担当者は変数で管理し、担当変更時にワークフローを書き換えず差し替えられるようにします。

確認

  • OYKOT-jpの対象15リポジトリへ CLAUDE_PR_ASSIGNEE を設定済み
  • 既存の同種open PR 62件へ担当者をアサイン済み
  • OYKOT-jpの14リポジトリは更新済み、ルールセット対象の1リポジトリはPR #220で反映中

Summary by CodeRabbit

  • New Features

    • Added optional pull-request assignee configuration for automated pull requests.
    • Pull requests can now be automatically assigned when an assignee is configured; otherwise, behavior remains unchanged.
  • Tests

    • Added coverage to verify the assignee configuration and pull-request creation behavior.

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Claude workflows now support an optional CLAUDE_PR_ASSIGNEE repository variable. When set, the workflows assign created pull requests. Contract tests verify the configuration and command arguments.

Changes

Claude pull-request assignee

Layer / File(s) Summary
Optional assignee workflow wiring
.github/workflows/claude.yml, templates/workflows/claude.yml
Both workflows read CLAUDE_PR_ASSIGNEE, build conditional --assignee arguments, and pass them to gh pr create.
Workflow contract validation
test/claude-workflow-contract.test.js
The contract test verifies the assignee variable, argument construction, and command expansion.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: automatically assigning Claude-generated pull requests to a repository owner.
Description check ✅ Passed The description explains the changes, motivation, and verification results, but it does not use all template headings or include the checklist and related-item sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/claude-pr-auto-assignee

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/claude-workflow-contract.test.js

Oops! Something went wrong! :(

ESLint: 10.8.0

ReferenceError: describe is not defined
at Object. (/test/eslint-config.test.js:35:1)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:326:3)
at ModuleWrap. (node:internal/modules/esm/translators:231:7)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26


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.

@keito4
keito4 marked this pull request as ready for review August 2, 2026 07:50
@claude

claude Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 2m 53s —— View job


I'll analyze this and get back to you.

@keito4 keito4 self-assigned this Aug 2, 2026

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/claude-workflow-contract.test.js`:
- Around line 66-68: Add assertions in the workflow contract test alongside the
existing PR_ASSIGNEE checks for the empty array initialization
`ASSIGNEE_ARGS=()` and the `if [ -n "$PR_ASSIGNEE" ]; then` guard, ensuring the
unset-assignee branch remains covered.
🪄 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 Plus

Run ID: 10724d4b-5c65-47b4-92f8-b7cd5dc4accf

📥 Commits

Reviewing files that changed from the base of the PR and between 747f1ab and 6f56574.

📒 Files selected for processing (3)
  • .github/workflows/claude.yml
  • templates/workflows/claude.yml
  • test/claude-workflow-contract.test.js

Comment on lines +66 to +68
expect(workflow).toContain('PR_ASSIGNEE: ${{ vars.CLAUDE_PR_ASSIGNEE }}');
expect(workflow).toContain('ASSIGNEE_ARGS=(--assignee "$PR_ASSIGNEE")');
expect(workflow).toContain('"${ASSIGNEE_ARGS[@]}"');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

for file in \
  .github/workflows/claude.yml \
  templates/workflows/claude.yml \
  test/claude-workflow-contract.test.js
do
  echo "== $file =="
  rg -n -C 8 'PR_ASSIGNEE|ASSIGNEE_ARGS|if \[ -n' "$file" || true
done

Repository: keito4/config

Length of output: 7147


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== test/claude-workflow-contract.test.js lines 1-90 =="
cat -n test/claude-workflow-conflow.test.js 2>/dev/null || sed -n '1,120p' test/claude-workflow-contract.test.js

echo
echo "== exact guard patterns =="
python3 - <<'PY'
from pathlib import Path
for path in ["test/claude-workflow-contract.test.js", "templates/workflows/claude.yml", ".github/workflows/claude.yml"]:
    p = Path(path)
    print(f"-- {path} --")
    if p.exists():
        s = p.read_text()
        for pat in [
            'ASSIGNEE_ARGS=()',
            'if [ -n "$PR_ASSIGNEE" ]; then',
            'ASSIGNEE_ARGS=(--assignee "$PR_ASSIGNEE")',
            '{"ASSIGNEE_ARGS[@]}"',
            'if [ -z "$PR_ASSIGNEE" ]; then',
            'PR_ASSIGNEE=""',
        ]:
            print(f"{pat!r}: {pat in s}")
PY

Repository: keito4/config

Length of output: 7003


Add coverage for the unset PR_ASSIGNEE branch.

The contract asserts that the non-empty ASSIGNEE_ARGS construction and expansion are present, but it does not assert ASSIGNEE_ARGS=() or if [ -n "$PR_ASSIGNEE" ]; then. Add those assertions so the test fails if the conditional guard is accidentally removed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/claude-workflow-contract.test.js` around lines 66 - 68, Add assertions
in the workflow contract test alongside the existing PR_ASSIGNEE checks for the
empty array initialization `ASSIGNEE_ARGS=()` and the `if [ -n "$PR_ASSIGNEE" ];
then` guard, ensuring the unset-assignee branch remains covered.

@keito4
keito4 merged commit 2829b48 into main Aug 2, 2026
23 checks passed
@keito4
keito4 deleted the agent/claude-pr-auto-assignee branch August 2, 2026 08:03
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.132.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant