Skip to content

Commit

Permalink
+8 - switch upstream pretest to force-tracking branches
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Dec 15, 2024
1 parent 273b02f commit d5a9c14
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/upstream pretest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,10 @@ jobs:
$repo_name = $matches[2]
$fork_url = "[email protected]: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)
}
Expand Down Expand Up @@ -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"
Expand All @@ -385,11 +378,12 @@ jobs:
Write-Host "Updating subm fork..."
Push-Location './fork'
git remote add $remote_official "[email protected]:${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" }
Expand Down Expand Up @@ -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}:"
Expand Down Expand Up @@ -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 = @()
Expand Down

0 comments on commit d5a9c14

Please sign in to comment.