Repository navigation
feat: switch to org-level reusable Claude Code workflow #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||||||||||||
| # AI-assisted code review via Claude Code Action on PRs. | ||||||||||||||||||||||||||||||||
| # Issue automation: implement, open PR, self-review, check CI, notify maintainer. | ||||||||||||||||||||||||||||||||
| # Claude Code — thin caller that delegates to the org-level reusable workflow. | ||||||||||||||||||||||||||||||||
| # All logic and prompts are maintained centrally in claude-code-reusable.yml. | ||||||||||||||||||||||||||||||||
| # Standard: https://github.com/petry-projects/.github/blob/main/standards/ci-standards.md#4-claude-code-claudeyml | ||||||||||||||||||||||||||||||||
| name: Claude Code | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -17,81 +17,13 @@ on: | |||||||||||||||||||||||||||||||
| permissions: {} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| # Interactive mode: PR reviews and @claude mentions | ||||||||||||||||||||||||||||||||
| claude: | ||||||||||||||||||||||||||||||||
| if: >- | ||||||||||||||||||||||||||||||||
| (github.event_name == 'pull_request' && | ||||||||||||||||||||||||||||||||
| github.event.pull_request.head.repo.full_name == github.repository) || | ||||||||||||||||||||||||||||||||
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && | ||||||||||||||||||||||||||||||||
| contains(github.event.comment.body, '@claude') && | ||||||||||||||||||||||||||||||||
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) || | ||||||||||||||||||||||||||||||||
| (github.event_name == 'pull_request_review_comment' && | ||||||||||||||||||||||||||||||||
| contains(github.event.comment.body, '@claude') && | ||||||||||||||||||||||||||||||||
| contains(fromJson('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) | ||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||
| timeout-minutes: 60 | ||||||||||||||||||||||||||||||||
| claude-code: | ||||||||||||||||||||||||||||||||
| uses: petry-projects/.github/.github/workflows/claude-code-reusable.yml@main | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| uses: petry-projects/.github/.github/workflows/claude-code-reusable.yml@main | |
| uses: petry-projects/.github/.github/workflows/claude-code-reusable.yml@<PINNED_COMMIT_SHA> |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
secrets: inherit passes all repository/environment secrets to the called workflow. Even if the org workflow is trusted, this is broader than necessary and increases blast radius if the reusable workflow is ever modified or misconfigured. Prefer passing only the required secrets (e.g., CLAUDE_CODE_OAUTH_TOKEN / GH_PAT_WORKFLOWS) explicitly.
| secrets: inherit | |
| secrets: | |
| CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| GH_PAT_WORKFLOWS: ${{ secrets.GH_PAT_WORKFLOWS }} |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR description says this adds a token with workflows write scope so Claude can push .github/workflows/*, but this job’s permissions don’t include workflows: write. Because reusable workflows can’t elevate permissions beyond the caller, Claude still won’t be able to modify workflow files via GITHUB_TOKEN unless workflows: write is granted here (or you rely solely on a PAT).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing workflows: write permission contradicts PR objectives.
The PR description states this change "Adds a github_token with workflows write scope enabling Claude to push files into .github/workflows/". However, the permissions block does not include workflows: write. Without this permission, Claude will still be blocked from modifying workflow files.
If the intent is to grant this permission from within the reusable workflow, note that callers cannot grant more permissions than they themselves possess—the permission must be declared here.
Proposed fix to add the missing permission
permissions:
contents: write
id-token: write
pull-requests: write
issues: write
actions: read
checks: read
+ workflows: write📝 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.
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| issues: write | |
| actions: read | |
| checks: read | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| issues: write | |
| actions: read | |
| checks: read | |
| workflows: write |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/claude.yml around lines 23 - 29, The permissions block in
the workflow is missing the required workflows: write permission described in
the PR; update the permissions map (the permissions: block in
.github/workflows/claude.yml) to include workflows: write alongside contents:
write, id-token: write, pull-requests: write, issues: write, actions: read,
checks: read so the generated github_token can push to .github/workflows/, and
ensure this permission is declared in this reusable workflow (callers cannot
elevate permissions for it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job now delegates to a reusable workflow without any of the previous job-level
if:guards (same-repo PR check +@claudeauthor_association allowlist). If the reusable workflow doesn’t replicate those checks, this becomes a security regression (external users could trigger the automation via comments/PR review comments). Consider keeping theif:conditions here in the caller (or add an explicit note + link to where the checks live in the reusable workflow).