Skip to content

Fix PR preview responder setting correct origin remote#2528

Merged
wwwillchen-bot merged 1 commit intodyad-sh:mainfrom
wwwillchen:fix-pr-responder
Feb 6, 2026
Merged

Fix PR preview responder setting correct origin remote#2528
wwwillchen-bot merged 1 commit intodyad-sh:mainfrom
wwwillchen:fix-pr-responder

Conversation

@wwwillchen-bot
Copy link
Copy Markdown
Collaborator

@wwwillchen-bot wwwillchen-bot commented Feb 6, 2026

#skip-bb


Open with Devin

Summary by cubic

Fixes the PR review responder so pushes go to the PR’s fork instead of the base repo on forked PRs. Exposes the head repository and sets origin’s pushurl to ensure correct push behavior.

  • Bug Fixes
    • Exposes head_repo from workflow_run (run.head_repository.full_name) for later steps.
    • Adds a step to set origin’s pushurl to the PR’s head repo using GITHUB_TOKEN, preventing accidental pushes to the base repo after claude-code-action rewrites origin.

Written for commit 9ca4297. Summary will update on new commits.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 6, 2026

Greptile Overview

Greptile Summary

This PR adjusts the PR Review Responder workflow to keep pushes targeting the PR head repository when the anthropics/claude-code-action overwrites the origin remote URL (notably on workflow_run for fork PRs). It does this by capturing the workflow run’s head_repository.full_name and configuring origin’s pushurl to the head repo using the workflow GITHUB_TOKEN, so git push prefers the fork even if origin.url is changed.

Confidence Score: 3/5

  • This PR is close to safe to merge, but there is a workflow-crashing null-dereference that should be fixed first.
  • Change is small and localized, but it adds an unconditional dereference of workflow_run.head_repository in the github-script step; that field is explicitly treated as nullable elsewhere and can crash the job in those cases.
  • .github/workflows/pr-review-responder.yml

Important Files Changed

Filename Overview
.github/workflows/pr-review-responder.yml Adds head_repo output and configures origin pushurl to the PR head repository to avoid claude-code-action overwriting origin fetch URL.

Sequence Diagram

sequenceDiagram
  autonumber
  participant CI as CI workflow
  participant PRRR as PR Review Responder (workflow_run)
  participant GHAPI as GitHub API
  participant CO as actions/checkout
  participant GIT as git
  participant CCA as claude-code-action

  CI-->>PRRR: workflow_run(completed)
  PRRR->>GHAPI: pulls.get / pulls.list (resolve pr_number & labels)
  GHAPI-->>PRRR: PR details
  PRRR->>CO: checkout head_repository/head_branch
  CO-->>PRRR: repo checked out (origin set)
  PRRR->>GIT: record HEAD sha
  PRRR->>GIT: set origin pushurl to head_repo (new)
  PRRR->>CCA: run /dyad:pr-fix
  CCA-->>GIT: may commit & push
  PRRR->>GHAPI: gh pr view headRefOid
  PRRR-->>PRRR: if sha changed, re-trigger workflows
  PRRR->>GHAPI: gh workflow run (ci/bugbot/claude-pr-review)
  PRRR->>GHAPI: update PR labels (pending/done/failed/re-request)
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 6, 2026

Additional Comments (1)

.github/workflows/pr-review-responder.yml
Unconditional head_repository deref

core.setOutput('head_repo', run.head_repository.full_name); runs unconditionally in the github-script step. In workflow_run payloads run.head_repository can be null (you already note/handle this in the fallback branch), so this line will throw and fail the workflow whenever the head repo isn’t available (e.g., fork deleted). Consider guarding this output (and anything depending on it) the same way you guard the fallback path, or deriving head_repo from the fetched pr object instead.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/pr-review-responder.yml
Line: 149:155

Comment:
**Unconditional `head_repository` deref**

`core.setOutput('head_repo', run.head_repository.full_name);` runs unconditionally in the github-script step. In `workflow_run` payloads `run.head_repository` can be `null` (you already note/handle this in the fallback branch), so this line will throw and fail the workflow whenever the head repo isn’t available (e.g., fork deleted). Consider guarding this output (and anything depending on it) the same way you guard the fallback path, or deriving `head_repo` from the fetched `pr` object instead.

How can I resolve this? If you propose a fix, please make it concise.

@wwwillchen-bot wwwillchen-bot merged commit 0be9498 into dyad-sh:main Feb 6, 2026
6 of 8 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants