diff --git a/.github/workflows/check_sonar_tests.yml b/.github/workflows/check_sonar_tests.yml index 3123794..076e147 100644 --- a/.github/workflows/check_sonar_tests.yml +++ b/.github/workflows/check_sonar_tests.yml @@ -10,6 +10,8 @@ env: OWNER: ${{ github.repository_owner }} REPO: ${{ github.event.repository.name }} PR_NUMBER: ${{ github.event.number }} + BRANCH_ORIGIN: ${{ github.head_ref }} + BASE_BRANCH: ${{ github.base_ref }} SONAR_HOST_URL: "https://sonarqube.trustly.one" SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_SECRET }} SONAR_PROJECT_KEY: "trustly-ios" @@ -25,6 +27,14 @@ jobs: with: fetch-depth: 0 + - name: Get Git Revision (Commit SHA) + id: git_revision + run: | + cd trustly-android-sdk || exit + git fetch origin "${BRANCH_ORIGIN}" + GIT_REVISION=$(git rev-parse origin/${BRANCH_ORIGIN}) + echo "Git Revision: $GIT_REVISION" + - name: Install dependencies run: | # Update Homebrew @@ -51,6 +61,10 @@ jobs: run: | # Create sonar-project.properties or update it dynamically echo "sonar.login=${{ secrets.SONAR_TOKEN_SECRET }}" >> sonar-project.properties + echo "sonar.pullrequest.key=${{ github.event.number }}" >> sonar-project.properties + echo "sonar.pullrequest.branch=${{ github.head_ref }}" >> sonar-project.properties + echo "sonar.pullrequest.base=${{ github.base_ref }}" >> sonar-project.properties + echo "sonar.scm.revision=${GIT_REVISION}" >> sonar-project.properties - name: Run Sonar-Swift Script run: |