Skip to content

Commit 9ab4c43

Browse files
committed
fix: checkout target branch before making changes
The previous implementation was creating PRs with the entire diff between the default branch and target branch. Now we properly checkout the target branch first, then make dependency updates on top of it. This ensures PRs only contain the dependency changes, not all differences between branches.
1 parent 7628443 commit 9ab4c43

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

updater/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ runs:
109109
with:
110110
token: ${{ inputs.api-token }}
111111

112+
- name: Checkout target branch
113+
if: inputs.target-branch != ''
114+
shell: bash
115+
run: |
116+
git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }}
117+
git checkout ${{ inputs.target-branch }}
118+
112119
- name: Update to the latest version
113120
id: target
114121
shell: pwsh
@@ -235,6 +242,13 @@ runs:
235242
with:
236243
token: ${{ inputs.api-token }}
237244

245+
- name: 'After new PR: checkout target branch'
246+
if: ${{ inputs.target-branch != '' && ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
247+
shell: bash
248+
run: |
249+
git fetch origin ${{ inputs.target-branch }}:${{ inputs.target-branch }}
250+
git checkout ${{ inputs.target-branch }}
251+
238252
- name: 'After new PR: redo the update'
239253
if: ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.existing-pr.outputs.url == '') && ( steps.root.outputs.changed == 'false') }}
240254
shell: pwsh

0 commit comments

Comments
 (0)