perf(ci): replace apk add git with Gitea archive API for Node.js jobs

apk add git downloads from dl-cdn.alpinelinux.org (Fastly CDN) which is
slow/blocked in Iran — caused 6m+ checkout times.

New approach: wget the repo tarball from Gitea's archive API endpoint.
wget + tar (busybox) are already in node:20-alpine — no package install.
Gitea is on the same machine as the runner = download is instant.

GET /api/v1/repos/{owner}/{repo}/archive/{sha}.tar.gz
Authorization: Bearer {token}

dotnet/sdk jobs unchanged — Debian base has git pre-installed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-05-28 17:12:49 +03:30
parent ca17cffee6
commit f825c72ca2
+36 -28
View File
@@ -147,14 +147,16 @@ jobs:
- name: Checkout
env:
TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
apk add --no-cache git
git init
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git config http.extraheader "Authorization: Bearer ${TOKEN}"
git fetch --depth=1 origin "${REF}"
git checkout FETCH_HEAD
# No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
# Downloads the repo tarball directly from Gitea (same machine = instant).
wget -q \
--header "Authorization: Bearer ${TOKEN}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
-O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies
working-directory: web/dashboard
@@ -179,14 +181,16 @@ jobs:
- name: Checkout
env:
TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
apk add --no-cache git
git init
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git config http.extraheader "Authorization: Bearer ${TOKEN}"
git fetch --depth=1 origin "${REF}"
git checkout FETCH_HEAD
# No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
# Downloads the repo tarball directly from Gitea (same machine = instant).
wget -q \
--header "Authorization: Bearer ${TOKEN}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
-O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies
working-directory: web/admin
@@ -211,14 +215,16 @@ jobs:
- name: Checkout
env:
TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
apk add --no-cache git
git init
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git config http.extraheader "Authorization: Bearer ${TOKEN}"
git fetch --depth=1 origin "${REF}"
git checkout FETCH_HEAD
# No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
# Downloads the repo tarball directly from Gitea (same machine = instant).
wget -q \
--header "Authorization: Bearer ${TOKEN}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
-O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies
working-directory: web/website
@@ -243,14 +249,16 @@ jobs:
- name: Checkout
env:
TOKEN: ${{ github.token }}
REF: ${{ github.ref }}
SHA: ${{ github.sha }}
run: |
apk add --no-cache git
git init
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git"
git config http.extraheader "Authorization: Bearer ${TOKEN}"
git fetch --depth=1 origin "${REF}"
git checkout FETCH_HEAD
# No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
# Downloads the repo tarball directly from Gitea (same machine = instant).
wget -q \
--header "Authorization: Bearer ${TOKEN}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
-O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies
working-directory: web/finder