Skip to content

Add Claude Code GitHub Workflow#94

Merged
NikolayS merged 1 commit intomasterfrom
add-claude-github-actions-1776374991
Apr 16, 2026
Merged

Add Claude Code GitHub Workflow#94
NikolayS merged 1 commit intomasterfrom
add-claude-github-actions-1776374991

Conversation

@NikolayS
Copy link
Copy Markdown
Owner

🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

Required before merge

This workflow requires a CLAUDE_CODE_OAUTH_TOKEN repository secret, which is not yet set on this repo. Set it by either:

  • Running /install-github-app in a Claude Code session rooted at a local checkout of this repo, or
  • Setting it manually: gh secret set CLAUDE_CODE_OAUTH_TOKEN -R NikolayS/REPO --body "<token>"

Merging before the secret is set is safe — the workflow simply won't run successfully until the secret exists.

Important Notes

  • @claude mentions won't work until after merge + secret is configured
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • The OAuth token is stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with the repo by creating comments, branches, and commits

There's more information in the Claude Code action repo.

Adds .github/workflows/claude.yml and claude-code-review.yml so @claude
mentions in issues/PRs trigger the Claude Code GitHub Action. Requires
the CLAUDE_CODE_OAUTH_TOKEN repo secret to be set before the workflow
will run successfully.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

jobs:
claude:
if: |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The current if: gate only checks for @claude. On a public repo, that means any user who can open an issue or leave a comment can trigger this workflow (and it will have access to CLAUDE_CODE_OAUTH_TOKEN). Consider restricting to trusted author_association values.

Suggested change
if: |
if: |
(
github.event_name == 'issue_comment' &&
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)
) ||
(
github.event_name == 'pull_request_review' &&
contains(github.event.review.body, '@claude') &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.review.author_association)
) ||
(
github.event_name == 'issues' &&
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.issue.author_association)
)

types: [created]
pull_request_review_comment:
types: [created]
issues:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you want this to run on issues: opened? That event can be triggered by anyone filing a new issue, and a simple @claude in the title/body would start a run. If the intent is only opt-in via comments/reviews, dropping the issues trigger (or tightening the if: even further for github.event_name == 'issues') would reduce noise and risk.

# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pull-requests: read means this job likely can't post review comments/status back to the PR. If the action is expected to leave feedback on the PR, you may need pull-requests: write (and possibly issues: write).

@NikolayS NikolayS merged commit 455c2f6 into master Apr 16, 2026
11 checks passed
@NikolayS NikolayS deleted the add-claude-github-actions-1776374991 branch April 16, 2026 21:53
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