Skip to content

Commit 844c24f

Browse files
committed
fix: .github: mirror: Same branch checkout
Use switch to detach head, to avoid failure if current checkout branch has the same name. Signed-off-by: Jorge Marques <jorge.marques@analog.com>
1 parent 424059e commit 844c24f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.github/workflows/mirror.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ jobs:
3232
3333
- name: update-mirror
3434
run: |
35+
git switch -d
3536
git remote add ${{ inputs.remote_name }} ${{ inputs.fetch_url }} 2>/dev/null || \
3637
git remote set-url ${{ inputs.remote_name }} ${{ inputs.fetch_url }}
3738
target_branch=mirror/${{ inputs.remote_name }}/${{ inputs.branch }}
3839
git remote prune origin
3940
git remote prune ${{ inputs.remote_name }}
4041
git fetch ${{ inputs.remote_name }} ${{ inputs.branch }}:$target_branch -f
41-
git checkout $target_branch
42+
git switch $target_branch
4243
4344
if [[ "${{ inputs.patch_ci }}" == "true" ]]; then
4445
git fetch origin "${{ inputs.ci_branch }}" --depth=1

0 commit comments

Comments
 (0)