Skip to content

Appears that action doesn't work with PRs from forks? #14

@chris-edstrom

Description

@chris-edstrom

Describe the bug
When trying to get a review for a PR from a fork, the action fails trying to checkout the branch from the fork

To Reproduce
I have a PR from a fork into my repo. When I ask the AI to review, i get:

Making POST request to: http://git/api/v1/repos/MyOrg/MyRepo/issues/4152/comments
✅ Created initial comment with ID: 56978
Fetching PR #4152 data using REST API
Making GET request to: http://git/api/v1/repos/MyOrg/MyRepo/pulls/4152
Making GET request to: http://git/api/v1/repos/MyOrg/MyRepo/issues/4152/comments
Making GET request to: http://git/api/v1//repos/MyOrg/MyRepo/pulls/4152/files
Image downloading temporarily disabled during Octokit migration
Making GET request to: http://git/api/v1//repos/MyOrg/MyRepo
This is an open PR, checking out PR branch...
fatal: couldn't find remote ref some-branch-in-the-fork

Expected behavior
I would expect it to check out the PR branch, not the branch from the fork, which it can't find anyway

Workflow yml file

name: Claude Assistant
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  issues:
    types: [opened, assigned, labeled]
  pull_request_review:
    types: [submitted]

permissions:
  contents: write
  pull-requests: write
  issues: write
  actions: read # Required for CI access

jobs:
  claude-response:
    runs-on: ubuntu-latest
    steps:
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v5.1.0
        with:
          aws-region: "us-east-1"
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha || (github.event.issue.pull_request && format('refs/pull/{0}/head', github.event.issue.number)) || github.ref }}  #needed, or it checkout out main
          fetch-depth: 0
      - uses: markwylde/claude-code-gitea-action@v1.0.20
        with:
          gitea_api_url: http://my.git.server
          use_bedrock: true
          model: anthropic.claude-sonnet-4-5-20250929-v1:0
          additional_permissions: |
            actions: read
        env:
          GITEA_SERVER_URL: http://my.git.server

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions