Skip to content

Commit

Permalink
+7
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Aug 31, 2024
1 parent a847edd commit a21dfd2
Showing 1 changed file with 21 additions and 38 deletions.
59 changes: 21 additions & 38 deletions .github/workflows/upstream pretest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ jobs:
uses: actions/checkout@main
with:
ref: ${{ github.event.repository.default_branch }}
path: './POCGL'
path: './core'
fetch-depth: 0

- name: checkout subm fork
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
Write-Host "Updating main repo..."
Push-Location './POCGL'
Push-Location './core'
git fetch --all 2>&1 | Out-Null
$core_main_branch_name = '${{ github.event.repository.default_branch }}'
Expand Down Expand Up @@ -453,13 +453,21 @@ jobs:
git config --global user.email "sunserega2@gmail.com"
git config --global --add url.https://github.com/.insteadOf "git@github.com:"
- name: checkout main repo
uses: actions/checkout@main
with:
path: './core'
sparse-checkout-cone-mode: false
sparse-checkout: '<NOTHING>'

- name: checkout subm fork
uses: actions/checkout@main
with:
repository: ${{ matrix.remove-data.fork_repo }}
token: ${{ secrets.POCGL_pretest_upstream_PAT }}
path: './fork'
sparse-checkout-cone-mode: false
sparse-checkout: '<NOTHING>'
repository: ${{ matrix.remove-data.fork_repo }}
token: ${{ secrets.POCGL_pretest_upstream_PAT }}

- name: (!) remove old pretest branches
run: |
Expand All @@ -477,36 +485,7 @@ jobs:
# Write-Host "=============================="
# git config -l
# if (-not $?) { throw "git config -l failed" }
# Write-Host "=============================="
$main_repo_dir = './core'
New-Item -ItemType Directory -Path $main_repo_dir | Out-Null
Push-Location $main_repo_dir
$main_repo_url = '${{ github.server_url }}/${{ github.repository }}'
Write-Host "Cloning main repo [$main_repo_url]"
git clone --filter=tree:0 --no-progress --no-checkout $main_repo_url .
if (-not $?) { throw "git clone failed" }
# git init
# if (-not $?) { throw "git init failed" }
# git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${{ github.token }}"
# if (-not $?) { throw "git config failed" }
# Write-Host "=============================="
# git config -l
# if (-not $?) { throw "git config -l failed" }
# Write-Host "=============================="
# git remote add origin $main_repo_url
# if (-not $?) { throw "git remote add failed" }
# git -c protocol.version=2 fetch --no-tags --prune --depth=1 origin --filter=tree:0 --no-progress
# if (-not $?) { throw "git fetch failed" }
# git branch -r
Push-Location './core'
$core_removed_pr_nums = @()
foreach ($pr_num in $core_pretest_pr_nums) {
Expand All @@ -524,27 +503,29 @@ jobs:
if (-not $?) { throw "git show failed" }
if ($is_trivial) {
Write-Host "Is trivial, removing..."
git push origin --delete $branch_name # BRANCH DELETE
# git push origin --delete $branch_name # BRANCH DELETE
if (-not $?) { throw "git push --delete failed" }
$core_removed_pr_nums += $pr_num
}
Write-Host '~~~~~'
}
Pop-Location
$core_pretest_pr_nums = $core_pretest_pr_nums |
Where-Object { $_ -notin $core_removed_pr_nums }
Pop-Location
Push-Location './fork'
foreach ($pr_num in $subm_pretest_pr_nums) {
Write-Host "PR $pr_num was closed"
if ($core_pretest_pr_nums -contains $pr_num) {
Write-Host "But main repo is still referencing it"
} else {
Write-Host "Removing..."
git push origin --delete "pretest/$pr_num" # BRANCH DELETE
# git push origin --delete "pretest/$pr_num" # BRANCH DELETE
if (-not $?) { throw "git push --delete failed" }
}
Write-Host '~~~~~'
Expand All @@ -557,4 +538,6 @@ jobs:
}
throw "Some pretest branches in main repo are dangling"
}
Pop-Location

0 comments on commit a21dfd2

Please sign in to comment.