From c8624e7ceb80c0a442be0c3d60055a97f420564c Mon Sep 17 00:00:00 2001 From: nocci Date: Thu, 8 Jan 2026 13:08:54 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(workflows):=20replace=20ac?= =?UTF-8?q?tions/checkout=20with=20manual=20git=20checkout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - implement manual git checkout steps in build workflow - remove actions/checkout usage to customize git operations --- .forgejo/workflows/build.yml | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 400412a..2080e2d 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -15,8 +15,13 @@ jobs: container: image: node:20-alpine steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Manual Git Checkout + run: | + apk add --no-cache git + git init + git remote add origin ${{ github.server_url }}/${{ github.repository }}.git + git fetch --depth 1 origin ${{ github.ref }} + git checkout FETCH_HEAD - name: Install dependencies run: npm ci @@ -28,18 +33,25 @@ jobs: needs: lint runs-on: self-hosted steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Manual Git Checkout + run: | + apt-get update + apt-get install -y git + git init + git remote add origin ${{ github.server_url }}/${{ github.repository }}.git + git fetch --depth 1 origin ${{ github.ref }} + git checkout FETCH_HEAD + - name: Install Node.js run: | apt-get update apt-get install -y curl curl -fsSL https://deb.nodesource.com/setup_20.x | bash - apt-get install -y nodejs + - name: Install Sonar Scanner (npm) run: npm install -g sonarqube-scanner + - name: SonarQube Scan env: SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} @@ -83,12 +95,16 @@ jobs: needs: [lint, sonar] runs-on: self-hosted steps: + - name: Manual Git Checkout + run: | + git init + git remote add origin ${{ github.server_url }}/${{ github.repository }}.git + git fetch --depth 1 origin ${{ github.ref }} + git checkout FETCH_HEAD + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Checkout - uses: actions/checkout@v4 - - name: Login to registry run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin