File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -450,8 +450,17 @@ jobs:
450
450
git config --local committer.email "${{ env.BOT_GHA_EMAIL }}"
451
451
452
452
- name : Create local branch for PR
453
+ env :
454
+ PR_IS_CROSS_REPOSITORY : ${{ fromJSON(needs.pr.outputs.JSON).isCrossRepository }}
455
+ PR_REMOTE : " origin"
456
+ PR_REF : ${{ needs.pr.outputs.PR_REF }}
453
457
run : |
454
- git checkout -b "${{ needs.pr.outputs.PR_REF }}" FETCH_HEAD
458
+ if [[ "${PR_IS_CROSS_REPOSITORY}" == "true" ]]; then
459
+ PR_REMOTE="fork"
460
+ git remote add "${PR_REMOTE}" "${GITHUB_SERVER_URL}/${{ needs.pr.outputs.PR_REPO }}"
461
+ fi
462
+ echo "PR_REMOTE=${PR_REMOTE}" >> "${GITHUB_ENV}"
463
+ git checkout -b "${PR_REF}" --track "${PR_REMOTE}/${PR_REF}"
455
464
456
465
- name : Download lockfiles and lockfile diff files
457
466
uses : actions/download-artifact@v5
@@ -540,9 +549,7 @@ jobs:
540
549
# git push --force is for workflow re-runs, but only for new PRs.
541
550
run : |
542
551
git commit -F "${COMMIT_MSG}"
543
- git push${{ inputs.pr == 'new' && ' --force' || '' }} \
544
- "${GITHUB_SERVER_URL}/${{ needs.pr.outputs.PR_REPO }}" \
545
- "HEAD:${{ needs.pr.outputs.PR_REF }}"
552
+ git push${{ inputs.pr == 'new' && ' --force' || '' }} "${PR_REMOTE}" "${{ needs.pr.outputs.PR_REF }}"
546
553
547
554
- name : Create new PR
548
555
if : inputs.pr == 'new' && fromJSON(needs.pr.outputs.JSON).number == 'new' && env.CHANGED == 'true'
You can’t perform that action at this time.
0 commit comments