Skip to content

Commit ac1a0fb

Browse files
Copilotpetesramek
andauthored
fix: create target branch without switching workspace in promote-branch workflow
Agent-Logs-Url: https://github.com/petesramek/polyline-algorithm-csharp/sessions/8a7d8752-2079-4fae-a8c8-13b46a0a4629 Co-authored-by: petesramek <2333452+petesramek@users.noreply.github.com>
1 parent 87b7636 commit ac1a0fb

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

.github/workflows/promote-branch.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,12 @@ jobs:
206206
dotnet-version: ${{ env.dotnet-sdk-version }}
207207
- name: 'Create target branch'
208208
if: ${{ needs.workflow-variables.outputs.target-branch-exists == 'false' }}
209+
env:
210+
base-branch: ${{ needs.workflow-variables.outputs.base-branch }}
211+
target-branch: ${{ needs.workflow-variables.outputs.target-branch }}
209212
run: |
210-
git config user.name "$(git log -n 1 --pretty=format:%an)"
211-
git config user.email "$(git log -n 1 --pretty=format:%ae)"
212213
git fetch origin
213-
git switch ${{ needs.workflow-variables.outputs.base-branch }}
214-
git checkout -b ${{ needs.workflow-variables.outputs.target-branch }} origin/${{ needs.workflow-variables.outputs.target-branch }} || git checkout -b ${{ needs.workflow-variables.outputs.target-branch }}
215-
git push --set-upstream origin ${{ needs.workflow-variables.outputs.target-branch }}
214+
git push origin origin/${{ env.base-branch }}:refs/heads/${{ env.target-branch }}
216215
- name: 'Lock target branch'
217216
if: ${{ needs.workflow-variables.outputs.target-branch-exists == 'false' }}
218217
uses: './.github/actions/github/branch-protection/lock'

0 commit comments

Comments
 (0)