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