Skip to content

Commit

Permalink
[ci] Revive CI, 2nd try (#8607)
Browse files Browse the repository at this point in the history
  • Loading branch information
taichi-gardener authored Dec 19, 2024
1 parent 1c0e3a6 commit 4218a45
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ jobs:
run: |
git config --system core.longpaths true
git submodule foreach 'git rev-parse HEAD > /dev/null 2>&1 || rm -rf $PWD'
. .github/workflows/scripts/common-utils.ps1
UnsetGitCachingProxy
- uses: actions/checkout@v3
with:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/scripts/common-utils.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
function UnsetGitCachingProxy {
Write-Host "Unsetting git caching proxy"
git config --global --unset-all url.http://git-cdn-github.botmaster.tgr/.insteadOf
# git config --global --unset-all url.http://git-cdn-gitlab.botmaster.tgr/.insteadOf
git config --global --list | Select-String 'url\.' | ForEach-Object {
$key = $_ -split '=' | Select-Object -First 1
git config --global --unset-all $key
}
}

function SetGitCachingProxy {
Write-Host "Setting up git caching proxy"
git config --global --add url.http://git-cdn-github.botmaster.tgr/.insteadOf https://github.com/
git config --global --add url.http://git-cdn-github.botmaster.tgr/.insteadOf git@github.com:
# git config --global --add url.http://git-cdn-gitlab.botmaster.tgr/.insteadOf https://gitlab.com/
git config --global credential.helper "store --file $env:TEMP\.git-credentials"
"http://oauth2:${env:GITHUB_TOKEN}@git-cdn-github.botmaster.tgr" | Out-File -FilePath $env:TEMP\.git-credentials
git config --global --add "url.http://oauth2:${env:GITHUB_TOKEN}@git-cdn-github.botmaster.tgr/.insteadOf" https://github.com/
git config --global --add "url.http://oauth2:${env:GITHUB_TOKEN}@git-cdn-github.botmaster.tgr/.insteadOf" git@github.com:
}

if($env:TI_USE_GIT_CACHE) {
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/scripts/common-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ set -x

function unset-git-caching-proxy {
echo "Unsetting git caching proxy"
git config --global --unset-all url.http://git-cdn-github.botmaster.tgr/.insteadOf || true
# git config --global --unset-all url.http://git-cdn-gitlab.botmaster.tgr/.insteadOf || true
rm -f ~/.git-credentials
git config --global --list | grep 'url\.' | cut -d'=' -f1 | xargs -L1 git config --global --unset-all || true
}

function set-git-caching-proxy {
trap unset-git-caching-proxy EXIT
echo "Setting git caching proxy"
git config --global --add url.http://git-cdn-github.botmaster.tgr/.insteadOf https://github.com/
git config --global --add url.http://git-cdn-github.botmaster.tgr/.insteadOf [email protected]:
# git config --global --add url.http://git-cdn-gitlab.botmaster.tgr/.insteadOf https://gitlab.com/
git config --global credential.helper store
echo "http://oauth2:$GITHUB_TOKEN@git-cdn-github.botmaster.tgr" > ~/.git-credentials
git config --global --add url.http://oauth2:$GITHUB_TOKEN@git-cdn-github.botmaster.tgr/.insteadOf https://github.com/
git config --global --add url.http://oauth2:$GITHUB_TOKEN@git-cdn-github.botmaster.tgr/.insteadOf [email protected]:
}

if [ ! -z "$TI_USE_GIT_CACHE" ]; then
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,8 @@ jobs:
steps:
- name: Workaround checkout issues
run: |
. .github/workflows/scripts/common-utils.ps1
git config --system core.longpaths true
git submodule foreach 'git rev-parse HEAD > /dev/null 2>&1 || rm -rf $PWD' # no '|| true' here
UnsetGitCachingProxy
- uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 4218a45

Please sign in to comment.