From d5a9c14988c580bdeb54a69da54734fe96b73d10 Mon Sep 17 00:00:00 2001 From: Sun Serega Date: Sun, 15 Dec 2024 17:19:32 +0100 Subject: [PATCH] +8 - switch upstream pretest to force-tracking branches --- .github/workflows/upstream pretest.yaml | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/.github/workflows/upstream pretest.yaml b/.github/workflows/upstream pretest.yaml index d3e38a53..c3a97de7 100644 --- a/.github/workflows/upstream pretest.yaml +++ b/.github/workflows/upstream pretest.yaml @@ -105,17 +105,10 @@ jobs: $repo_name = $matches[2] $fork_url = "git@github.com:SunSerega/${repo_name}.git" - $mergeable_prs = @() - foreach ($l in Get-GitRemoteBranches $repo_url 'refs/pull/*/merge') { - $pr_num = $l.matches[1] - $mergeable_prs += $pr_num - } - $head_sha_by_pr = @{} - foreach ($l in Get-GitRemoteBranches $repo_url 'refs/pull/*/head') { + foreach ($l in Get-GitRemoteBranches $fork_url 'refs/force-tracking/*') { $sha = $l.sha $pr_num = $l.matches[1] - if ($pr_num -notin $mergeable_prs) { continue } Write-Host "- Found open PR $pr_num with latest sha $sha" $head_sha_by_pr.Add($pr_num, $sha) } @@ -373,8 +366,8 @@ jobs: $b_fork_main = 'custom' $b_fork_pretest = "pretest/$pr_num" - $b_fork_merged_pr_head = "$pr_num/merged_pr_head" # $pr_num/head + main - $b_fork_virgin_merge_test = "$pr_num/virgin_merge_test" # $b_merged_pr_head + custom + $b_fork_merged_pr_head = "$pr_num/merged_pr_head" # force-tracking/$pr_num + main + $b_fork_virgin_merge_test = "$pr_num/virgin_merge_test" # $b_fork_merged_pr_head + custom $b_core_main = '${{ github.event.repository.default_branch }}' $b_core_subm_pretest = "subm-pretest/$org_repo/$pr_num" @@ -385,11 +378,12 @@ jobs: Write-Host "Updating subm fork..." Push-Location './fork' git remote add $remote_official "git@github.com:${org_repo}.git" - git config --add "remote.$remote_official.fetch" "+refs/pull/*:refs/remotes/$remote_official/pull/*" - git fetch --all 2>&1 | Out-Null + if (-not $?) { throw "git remote add failed" } + git fetch $remote_official main 2>&1 | Out-Null + if (-not $?) { throw "git fetch failed" } Write-Host "- Creating $b_fork_merged_pr_head" - git checkout "remotes/$remote_official/pull/$pr_num/head" + git checkout "remotes/origin/force-tracking/$pr_num" if (-not $?) { throw "git checkout failed" } git checkout -b $b_fork_merged_pr_head if (-not $?) { throw "git checkout -b failed" } @@ -427,7 +421,7 @@ jobs: if (-not $?) { throw "git merge failed" } Write-Host "--- Merging with PR head:" - git merge "remotes/$remote_official/pull/$pr_num/head" + git merge "remotes/origin/force-tracking/$pr_num" if (-not $?) { throw "git merge failed" } Write-Host "--- Merging with ${b_fork_upstream_main}:" @@ -626,7 +620,7 @@ jobs: Write-Host "Adding meta to fork repo..." Push-Location './fork' - $pr_head_sha = git rev-parse "remotes/0_official/pull/$pr_num/head" + $pr_head_sha = git rev-parse "remotes/origin/force-tracking/$pr_num" if (-not $?) { throw "git rev-parse failed" } $meta_commit_message = @()