anthropics / anthropics/claude-code-action

Comments in (forked) PR trigger claude-code-action with wrong branch

Open
#46 18 comments 0 reactions 0 assignees View on GitHub
p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

I am using the https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml workflow.

According to https://github.com/orgs/community/discussions/25917,

> Comments on issues and pull requests will have the ref [set to the default branch](https://help.github.com/en/articles/events-that-trigger-workflows). However, you should be able to inspect the full [github event context ](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#contexts)for the information about the pull request in question.

Workflow triggered by issue_comment (thus a comment in PR) will checkout to the base branch, which provides wrong context for claude-code to work with.

What is the suggested way to fix this?

- Prompt Claude to let it checkout to the PR branch automatically?
- Make the action `actions/checkout@v4` checkout to the correct branch if on PR comments?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.