diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index e229218..e7abefc 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -34,6 +34,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} run: | + WORKDIR=${GITHUB_WORKSPACE:-$PWD} HOST_URL=${SONAR_HOST_URL:?SONAR_HOST_URL secret not set} PROJECT_KEY=${SONAR_PROJECT_KEY:-} if [ -z "$PROJECT_KEY" ] && [ -f sonar-project.properties ]; then @@ -49,19 +50,19 @@ jobs: echo "Sample files:" find . -maxdepth 2 -type f | head -n 20 echo "Check files inside scanner container:" - docker run --rm -v "$PWD:/usr/src" -w /usr/src alpine sh -c "ls -la /usr/src | head && find /usr/src -maxdepth 2 -type f -name '*.js' | head -n 20" + docker run --rm -v "$WORKDIR:/project" -w /project alpine sh -c "pwd; ls -la . | head && find . -maxdepth 2 -type f -name '*.js' | head -n 20" docker run --rm \ -e SONAR_HOST_URL="$HOST_URL" \ -e SONAR_TOKEN="$SONAR_TOKEN" \ - -v "$PWD:/usr/src" \ - -w /usr/src \ + -v "$WORKDIR:/project" \ + -w /project \ sonarsource/sonar-scanner-cli \ sonar-scanner \ -Dsonar.host.url="$HOST_URL" \ -Dsonar.projectKey="$PROJECT_KEY" \ -Dsonar.sources=. \ -Dsonar.scm.disabled=true \ - -Dsonar.projectBaseDir=/usr/src + -Dsonar.projectBaseDir=/project docker: needs: [lint, sonar]