Skip to content

Commit

Permalink
+10 - delete old pretest branches
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Aug 16, 2024
1 parent 3dfed58 commit a5d0688
Showing 1 changed file with 53 additions and 17 deletions.
70 changes: 53 additions & 17 deletions .github/workflows/upstream pretest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:
contents: write

jobs:
enmr_PRs:
enmr-PRs:
runs-on: windows-latest
outputs:
exec_list: ${{ steps.make_exec_list.outputs.exec_list }}
Expand All @@ -20,7 +20,11 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global --add url.https://github.com/.insteadOf "[email protected]:"
# git config --global --add url.https://github.com/.insteadOf "[email protected]:"
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: checkout
uses: actions/checkout@main
Expand All @@ -37,49 +41,81 @@ jobs:
foreach ($subm_key in git config --file .gitmodules --name-only --get-regexp '^submodule\..+\.url$') {
$subm_url = git config --file .gitmodules --get $subm_key
#Write-Host "URL: $subm_url"
# Write-Host "URL: $subm_url"
$pr_nums = @()
foreach ($ref_l in git ls-remote $subm_url 'refs/pull/*/merge') {
if ($ref_l -notmatch '^[0-9a-f]+\s+refs/pull/(\d+)/merge$') {
throw "Unexpected format: $ref_l"
}
$pr_num = $Matches[1]
#Write-Host "- Found PR $pr_num"
# Write-Host "- Found PR $pr_num"
$pr_nums += $pr_num
$exec_list += "$pr_num;$subm_url"
}
$subm_fork_url = $subm_url -replace 'KhronosGroup','SunSerega'
if ($subm_fork_url -eq $subm_url) {
throw "Cannot form fork URL from: $subm_url"
}
$fork_dir = './fork'
New-Item -ItemType Directory -Path $fork_dir | Out-Null
Push-Location $fork_dir
git init --bare
git remote add fork $subm_fork_url
foreach ($ref_l in git ls-remote $subm_fork_url 'refs/heads/pretest/*') {
if ($ref_l -notmatch '^[0-9a-f]+\s+refs/heads/pretest/(.+)$') {
throw "Unexpected format: $ref_l"
}
$pr_num = $Matches[1]
if ($pr_nums -contains $pr_num) { continue }
Write-Host "pretest branch for PR $pr_num is no longer needed"
git push fork --delete "pretest/$pr_num"
}
Pop-Location
Remove-Item -Recurse $fork_dir
}
$json = $exec_list | ConvertTo-Json -Compress
Write-Host $json
# Write-Host $json
echo "exec_list=$json" >> $env:GITHUB_OUTPUT
pretest-each:
runs-on: windows-latest
needs: enmr_PRs
needs: enmr-PRs
strategy:
fail-fast: false
matrix:
exec_node: ${{ fromJson(needs.enmr_PRs.outputs.exec_list) }}
exec_node: ${{ fromJson(needs.enmr-PRs.outputs.exec_list) }}

steps:
- name: git config
run: |
git config --global core.autocrlf false
git config --global user.name "sun pack bot"
git config --global user.email "[email protected]"
# git config --global --add url.https://github.com/.insteadOf "[email protected]:"
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: checkout
uses: actions/checkout@main

- name: pretest
run: |
$exec_node = "${{ matrix.exec_node }}"
$pr_num, $subm_url = $exec_node -split ';', 2
Write-Host "Testing PR#$pr_num from: $subm_url"
# Write-Host "Testing PR $pr_num from: $subm_url"
# git config --global core.autocrlf false
# git config --global user.name "sun pack bot"
# git config --global user.email "[email protected]"
# - name: checkout
# uses: actions/checkout@main
# with:
# token: ${{ secrets.PAT_TOKEN }}
# aaaaa

0 comments on commit a5d0688

Please sign in to comment.