Unverified 提交 0be9498f authored 作者: wwwillchen-bot's avatar wwwillchen-bot 提交者: GitHub

Fix PR preview responder setting correct origin remote (#2528)

#skip-bb <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2528" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end --> <!-- This is an auto-generated description by cubic. --> --- ## 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. <sup>Written for commit 9ca429753073a667b554987f3ab3e6f03a14355b. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> Co-authored-by: 's avatarWill Chen <willchen90@gmail.com>
上级 5e6440ab
...@@ -151,6 +151,7 @@ jobs: ...@@ -151,6 +151,7 @@ jobs:
core.setOutput('should_continue', 'true'); core.setOutput('should_continue', 'true');
core.setOutput('request_count', requestCount); core.setOutput('request_count', requestCount);
core.setOutput('current_label', currentLabel); core.setOutput('current_label', currentLabel);
core.setOutput('head_repo', run.head_repository.full_name);
- name: Checkout repository - name: Checkout repository
if: steps.pr-info.outputs.should_continue == 'true' if: steps.pr-info.outputs.should_continue == 'true'
...@@ -169,6 +170,18 @@ jobs: ...@@ -169,6 +170,18 @@ jobs:
id: before-claude id: before-claude
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure push remote for fork PRs
if: steps.pr-info.outputs.should_continue == 'true'
run: |
# claude-code-action overwrites origin's fetch URL to point to dyad-sh/dyad
# (using GITHUB_REPOSITORY which is always the base repo in workflow_run events).
# Setting pushurl separately ensures git push still targets the fork,
# because git uses pushurl over url when both are configured.
git remote set-url --push origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ steps.pr-info.outputs.head_repo }}.git"
echo "Configured pushurl to ${{ steps.pr-info.outputs.head_repo }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update labels to pending - name: Update labels to pending
if: steps.pr-info.outputs.should_continue == 'true' if: steps.pr-info.outputs.should_continue == 'true'
run: | run: |
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论