فهرست منبع

Revert "[DO NOT MERGE] testing sonar code coverage"

Alex Meijer 2 سال پیش
والد
کامیت
005ec6fb97
2فایلهای تغییر یافته به همراه4 افزوده شده و 12 حذف شده
  1. 1 4
      .github/workflows/build-test.yaml
  2. 3 8
      .github/workflows/sonar.yaml

+ 1 - 4
.github/workflows/build-test.yaml

@@ -51,8 +51,6 @@ jobs:
           PR_NUM: ${{ github.event.number }}
         run: |
           echo $PR_NUM > pr_num.txt
-          echo $GITHUB_BASE_REF > base.txt
-          echo $GITHUB_HEAD_REF > head.txt
       - name: Upload code coverage
         uses: actions/upload-artifact@v3
         with:
@@ -60,9 +58,8 @@ jobs:
           path: |
            coverage.out
            pr_num.txt
-           base.txt
-           head.txt
       
+
   frontend:
     runs-on: ubuntu-latest
     steps:

+ 3 - 8
.github/workflows/sonar.yaml

@@ -36,11 +36,6 @@ jobs:
             fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/oc-code-coverage.zip`, Buffer.from(download.data));
       - name: 'Unzip code coverage'
         run: unzip oc-code-coverage.zip -d coverage
-      - name: set env vars 
-        run: | 
-          echo "SONAR_PR_NUM=$(cat coverage/pr_num.txt)" >> $GITHUB_ENV
-          echo "SONAR_BASE=$(cat coverage/base.txt)" >> $GITHUB_ENV
-          echo "SONAR_HEAD=$(cat coverage/head.txt)" >> $GITHUB_ENV
       - name: SonarCloud Scan
         uses: sonarsource/sonarcloud-github-action@master
         env:
@@ -49,8 +44,8 @@ jobs:
         with:
           args: >
             -Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
-            -Dsonar.pullrequest.key=${{ env.SONAR_PR_NUM }}
-            -Dsonar.pullrequest.branch=${{ env.SONAR_HEAD }}
-            -Dsonar.pullrequest.base=${{ env.SONAR_BASE }}
+            -Dsonar.pullrequest.key=${{ github.event.workflow_run.pull_requests[0].number }}
+            -Dsonar.pullrequest.branch=${{ github.event.workflow_run.pull_requests[0].head.ref }}
+            -Dsonar.pullrequest.base=${{ github.event.workflow_run.pull_requests[0].base.ref }}
             -Dsonar.projectKey=opencost_opencost
             -Dsonar.organization=opencost