Skip to content

Commit 6ddb19b

Browse files
petesramekPete Sramekgithub-actions[bot]dependabot[bot]Copilot
authored
fixed promote-branch (#163)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Pete Sramek <petr.sramek@dropoutcoder.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 4c9d7ed commit 6ddb19b

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
@@ -205,13 +205,12 @@ jobs:
205205
dotnet-version: ${{ env.dotnet-sdk-version }}
206206
- name: 'Create target branch'
207207
if: ${{ needs.workflow-variables.outputs.target-branch-exists == 'false' }}
208+
env:
209+
base-branch: ${{ needs.workflow-variables.outputs.base-branch }}
210+
target-branch: ${{ needs.workflow-variables.outputs.target-branch }}
208211
run: |
209-
git config user.name "$(git log -n 1 --pretty=format:%an)"
210-
git config user.email "$(git log -n 1 --pretty=format:%ae)"
211212
git fetch origin
212-
git switch ${{ needs.workflow-variables.outputs.base-branch }}
213-
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 }}
214-
git push --set-upstream origin ${{ needs.workflow-variables.outputs.target-branch }}
213+
git push origin origin/${{ env.base-branch }}:refs/heads/${{ env.target-branch }}
215214
- name: 'Lock target branch'
216215
if: ${{ needs.workflow-variables.outputs.target-branch-exists == 'false' }}
217216
uses: './.github/actions/github/branch-protection/lock'

0 commit comments

Comments
 (0)