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 - name: Checkout
env: env:
TOKEN: ${{ github.token }} TOKEN: ${{ github.token }}
REF: ${{ github.ref }} SHA: ${{ github.sha }}
run: | run: |
apk add --no-cache git # No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
git init # Downloads the repo tarball directly from Gitea (same machine = instant).
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" wget -q \
git config http.extraheader "Authorization: Bearer ${TOKEN}" --header "Authorization: Bearer ${TOKEN}" \
git fetch --depth=1 origin "${REF}" "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
git checkout FETCH_HEAD -O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies - name: Install dependencies
working-directory: web/dashboard working-directory: web/dashboard
@@ -179,14 +181,16 @@ jobs:
- name: Checkout - name: Checkout
env: env:
TOKEN: ${{ github.token }} TOKEN: ${{ github.token }}
REF: ${{ github.ref }} SHA: ${{ github.sha }}
run: | run: |
apk add --no-cache git # No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
git init # Downloads the repo tarball directly from Gitea (same machine = instant).
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" wget -q \
git config http.extraheader "Authorization: Bearer ${TOKEN}" --header "Authorization: Bearer ${TOKEN}" \
git fetch --depth=1 origin "${REF}" "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
git checkout FETCH_HEAD -O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies - name: Install dependencies
working-directory: web/admin working-directory: web/admin
@@ -211,14 +215,16 @@ jobs:
- name: Checkout - name: Checkout
env: env:
TOKEN: ${{ github.token }} TOKEN: ${{ github.token }}
REF: ${{ github.ref }} SHA: ${{ github.sha }}
run: | run: |
apk add --no-cache git # No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
git init # Downloads the repo tarball directly from Gitea (same machine = instant).
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" wget -q \
git config http.extraheader "Authorization: Bearer ${TOKEN}" --header "Authorization: Bearer ${TOKEN}" \
git fetch --depth=1 origin "${REF}" "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
git checkout FETCH_HEAD -O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies - name: Install dependencies
working-directory: web/website working-directory: web/website
@@ -243,14 +249,16 @@ jobs:
- name: Checkout - name: Checkout
env: env:
TOKEN: ${{ github.token }} TOKEN: ${{ github.token }}
REF: ${{ github.ref }} SHA: ${{ github.sha }}
run: | run: |
apk add --no-cache git # No apk install needed — wget + tar (busybox) are pre-installed in node:20-alpine.
git init # Downloads the repo tarball directly from Gitea (same machine = instant).
git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" wget -q \
git config http.extraheader "Authorization: Bearer ${TOKEN}" --header "Authorization: Bearer ${TOKEN}" \
git fetch --depth=1 origin "${REF}" "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/archive/${SHA}.tar.gz" \
git checkout FETCH_HEAD -O /tmp/repo.tar.gz
tar -xzf /tmp/repo.tar.gz --strip-components=1
rm -f /tmp/repo.tar.gz
- name: Install dependencies - name: Install dependencies
working-directory: web/finder working-directory: web/finder