diff --git a/.github/workflows/upstream pretest.yaml b/.github/workflows/upstream pretest.yaml index a22062f9..2b7b10b3 100644 --- a/.github/workflows/upstream pretest.yaml +++ b/.github/workflows/upstream pretest.yaml @@ -187,19 +187,28 @@ jobs: $fork_main_branch_name = 'custom' $fork_branch_name = "pretest/$pr_num" if (&{ git show-ref --verify -q "refs/remotes/origin/$fork_branch_name"; $? }) { - Write-Host "Branch for PR $pr_num exists. Merging with ${fork_main_branch_name}:" + Write-Host "Branch for PR $pr_num exists" git checkout $fork_branch_name - git merge $fork_main_branch_name + + Write-Host "Merging latest commits from PR $pr_num" + git merge "remotes/0_official/pull/$pr_num/head" if (-not $?) { throw "git merge failed" } git push + if (-not $?) { throw "git push failed" } + } else { - Write-Host "Branch for PR $pr_num doesn't exist. Creating:" + Write-Host "Branch for PR $pr_num doesn't exist" + git checkout "remotes/0_official/pull/$pr_num/head" + + Write-Host "Creating:" git checkout -b $fork_branch_name git push --set-upstream origin $fork_branch_name + if (-not $?) { throw "git push failed" } + } - Write-Host "Merging latest commits from PR $pr_num" - git merge "remotes/0_official/pull/$pr_num/head" + Write-Host "Merging with ${fork_main_branch_name}:" + git merge $fork_main_branch_name if (-not $?) { throw "git merge failed" } git push if (-not $?) { throw "git push failed" } @@ -212,7 +221,6 @@ jobs: Push-Location './POCGL' git fetch --all 2>&1 | Out-Null - # $core_main_branch_name = '${{ github.head_ref || github.ref_name }}' $core_main_branch_name = '${{ github.event.repository.default_branch }}' $core_branch_name = "subm-pretest/$org_repo/$pr_num" if (&{ git show-ref --verify -q "refs/remotes/origin/$core_branch_name"; $? }) { @@ -288,7 +296,6 @@ jobs: New-Item -ItemType Directory -Path $main_repo_dir | Out-Null Push-Location $main_repo_dir $main_repo_url = '${{ github.server_url }}/${{ github.repository }}' - # $main_repo_branch = '${{ github.head_ref || github.ref_name }}' $main_repo_branch = '${{ github.event.repository.default_branch }}' Write-Host "Cloning main repo [$main_repo_url]: branch [$main_repo_branch]" git clone -b $main_repo_branch --filter=tree:0 --no-progress --no-checkout $main_repo_url .