From 37e8647b4103ac0d2dde229118aa0909f15400ed Mon Sep 17 00:00:00 2001 From: Thomas Schaffter Date: Thu, 25 Jan 2024 09:43:42 -0800 Subject: [PATCH] ci(sage-monorepo): try new sonar scan workflow for PRs (#2456) * Touch oc web app * Update sonar scan workflow --- .github/workflows/sonar-scan.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index d78d139cde..9054c437e3 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -4,6 +4,8 @@ on: types: [opened, synchronize, reopened] env: + HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} jobs: @@ -11,25 +13,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + name: Checkout ${{ env.HEAD_REF }} from repository ${{ env.HEAD_REPOSITORY }} with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ env.HEAD_REF }} + repository: ${{ env.HEAD_REPOSITORY }} fetch-depth: 0 - - run: | - echo "github.event.pull_request.head.ref: ${{ github.event.pull_request.head.ref }}" - echo "repository: ${{ github.event.pull_request.head.repo.full_name }}" - - name: Derive appropriate SHAs for base and head for `nx affected` commands uses: nrwl/nx-set-shas@v3 - - name: Can read sonar token - run: if [ -z ${SONAR_TOKEN+x} ]; then echo "var is unset"; else echo "var is set to XXX"; fi - - # - name: Set up the dev container - # uses: ./.github/actions/setup-dev-container + - name: Set up the dev container + uses: ./.github/actions/setup-dev-container - # - name: Scan the affected projects with Sonar - # run: | - # devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \ - # && nx affected --target=sonar" \ No newline at end of file + - name: Scan the affected projects with Sonar + run: | + devcontainer exec --workspace-folder ../sage-monorepo bash -c ". ./dev-env.sh \ + && nx affected --target=sonar" \ No newline at end of file