From 91d379d31935f6330d2e2444452d80e162e12cc2 Mon Sep 17 00:00:00 2001 From: khanhtranduy <130121475+khanhtranduy@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:45:43 +0700 Subject: [PATCH 1/4] skip test report from fork PR --- .github/workflow-template.yaml | 4 +++- .github/workflows/cart-ci.yaml | 4 +++- .github/workflows/customer-ci.yaml | 4 +++- .github/workflows/inventory-ci.yaml | 4 +++- .github/workflows/location-ci.yaml | 4 +++- .github/workflows/media-ci.yaml | 4 +++- .github/workflows/order-ci.yaml | 4 +++- .github/workflows/payment-ci.yaml | 4 +++- .github/workflows/payment-paypal-ci.yaml | 4 +++- .github/workflows/product-ci.yaml | 4 +++- .github/workflows/promotion-ci.yaml | 4 +++- .github/workflows/rating-ci.yaml | 4 +++- .github/workflows/search-ci.yaml | 4 +++- .github/workflows/tax-ci.yaml | 4 +++- 14 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.github/workflow-template.yaml b/.github/workflow-template.yaml index dbc20165d4..bb1b771aae 100644 --- a/.github/workflow-template.yaml +++ b/.github/workflow-template.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f {{SERVICE_NAME}} - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Unit-Test-Results path: "{{SERVICE_NAME}}/**/surefire-reports/*.xml" diff --git a/.github/workflows/cart-ci.yaml b/.github/workflows/cart-ci.yaml index 975977ae95..848710c9a4 100644 --- a/.github/workflows/cart-ci.yaml +++ b/.github/workflows/cart-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -pl cart -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Cart-Service-Unit-Test-Results path: "cart/**/surefire-reports/*.xml" diff --git a/.github/workflows/customer-ci.yaml b/.github/workflows/customer-ci.yaml index ae0b76ec82..2ef7b2e570 100644 --- a/.github/workflows/customer-ci.yaml +++ b/.github/workflows/customer-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f customer - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Customer-Service-Unit-Test-Results path: "customer/**/surefire-reports/*.xml" diff --git a/.github/workflows/inventory-ci.yaml b/.github/workflows/inventory-ci.yaml index b44f125816..2e0e904de4 100644 --- a/.github/workflows/inventory-ci.yaml +++ b/.github/workflows/inventory-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f inventory - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Inventory-Service-Unit-Test-Results path: "inventory/**/surefire-reports/*.xml" diff --git a/.github/workflows/location-ci.yaml b/.github/workflows/location-ci.yaml index 8a96953c94..04c932c1de 100644 --- a/.github/workflows/location-ci.yaml +++ b/.github/workflows/location-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f location - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Location-Service-Unit-Test-Results path: "location/**/surefire-reports/*.xml" diff --git a/.github/workflows/media-ci.yaml b/.github/workflows/media-ci.yaml index bab0480b0d..6225e9e784 100644 --- a/.github/workflows/media-ci.yaml +++ b/.github/workflows/media-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f media - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Media-Service-Unit-Test-Results path: "media/**/surefire-reports/*.xml" diff --git a/.github/workflows/order-ci.yaml b/.github/workflows/order-ci.yaml index 8fccdc5955..522a061a18 100644 --- a/.github/workflows/order-ci.yaml +++ b/.github/workflows/order-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -pl order -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Order-Service-Unit-Test-Results path: "order/**/surefire-reports/*.xml" diff --git a/.github/workflows/payment-ci.yaml b/.github/workflows/payment-ci.yaml index f96c4e221f..d316bbbc48 100644 --- a/.github/workflows/payment-ci.yaml +++ b/.github/workflows/payment-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -pl payment -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Payment-Service-Unit-Test-Results path: "payment/**/surefire-reports/*.xml" diff --git a/.github/workflows/payment-paypal-ci.yaml b/.github/workflows/payment-paypal-ci.yaml index e3267fd391..d5dae65156 100644 --- a/.github/workflows/payment-paypal-ci.yaml +++ b/.github/workflows/payment-paypal-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f payment-paypal - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Payment-Paypal-Unit-Test-Results path: "payment-paypal/**/surefire-reports/*.xml" diff --git a/.github/workflows/product-ci.yaml b/.github/workflows/product-ci.yaml index 5effa8b920..c12c0f83ec 100644 --- a/.github/workflows/product-ci.yaml +++ b/.github/workflows/product-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -pl product -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Product-Service-Unit-Test-Results path: "product/**/surefire-reports/*.xml" diff --git a/.github/workflows/promotion-ci.yaml b/.github/workflows/promotion-ci.yaml index 3b420ee414..5eaee1d8a9 100644 --- a/.github/workflows/promotion-ci.yaml +++ b/.github/workflows/promotion-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f promotion - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Promotion-Service-Unit-Test-Results path: "promotion/**/surefire-reports/*.xml" diff --git a/.github/workflows/rating-ci.yaml b/.github/workflows/rating-ci.yaml index 38dabfe0e2..33358669bb 100644 --- a/.github/workflows/rating-ci.yaml +++ b/.github/workflows/rating-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f rating - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Rating-Service-Unit-Test-Results path: "rating/**/surefire-reports/*.xml" diff --git a/.github/workflows/search-ci.yaml b/.github/workflows/search-ci.yaml index 86c4c92961..ec29f10b0c 100644 --- a/.github/workflows/search-ci.yaml +++ b/.github/workflows/search-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f search - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Search-Service-Unit-Test-Results path: "search/**/surefire-reports/*.xml" diff --git a/.github/workflows/tax-ci.yaml b/.github/workflows/tax-ci.yaml index bc521335e1..36c21f3e9e 100644 --- a/.github/workflows/tax-ci.yaml +++ b/.github/workflows/tax-ci.yaml @@ -30,7 +30,9 @@ jobs: run: mvn test -f tax - name: Unit Test Results uses: dorny/test-reporter@v1 - if: success() || failure() + if: | + ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && + (success() || failure()) with: name: Tax-Service-Unit-Test-Results path: "tax/**/surefire-reports/*.xml" From ca0f1a99d75ffc9027a5a4a195b4c3e2aa32588a Mon Sep 17 00:00:00 2001 From: khanhtranduy <130121475+khanhtranduy@users.noreply.github.com> Date: Mon, 15 Jul 2024 14:18:55 +0700 Subject: [PATCH 2/4] Separate CI and Test Report workflow --- .github/workflows/product-ci.yaml | 11 ++++------ .../test-report/product-test-report.yaml | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test-report/product-test-report.yaml diff --git a/.github/workflows/product-ci.yaml b/.github/workflows/product-ci.yaml index c12c0f83ec..a53f8abca8 100644 --- a/.github/workflows/product-ci.yaml +++ b/.github/workflows/product-ci.yaml @@ -28,15 +28,12 @@ jobs: run: mvn clean install -DskipTests -pl product -am - name: Run Maven Test run: mvn test -pl product -am - - name: Unit Test Results - uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + - name: Upload Unit Test Results + uses: actions/upload-artifact@v4 # upload test results + if: success() || failure() with: - name: Product-Service-Unit-Test-Results + name: product-service-unit-test-results # artifact name path: "product/**/surefire-reports/*.xml" - reporter: java-junit - name: Analyze with sonar cloud if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} env: diff --git a/.github/workflows/test-report/product-test-report.yaml b/.github/workflows/test-report/product-test-report.yaml new file mode 100644 index 0000000000..3a120c996a --- /dev/null +++ b/.github/workflows/test-report/product-test-report.yaml @@ -0,0 +1,20 @@ +name: 'product test report' +on: + workflow_run: + workflows: ['product service ci'] # runs after product service ci workflow + types: + - completed +permissions: + contents: read + actions: read + checks: write +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: product-service-unit-test-results # artifact name + name: Product-Service-Unit-Test-Results + path: 'surefire-reports/*.xml' # Path to test results (inside artifact .zip) + reporter: java-junit # Format of test results \ No newline at end of file From 41ab60899d0846847f9939f9673ce3ae9c336eab Mon Sep 17 00:00:00 2001 From: khanhtranduy <130121475+khanhtranduy@users.noreply.github.com> Date: Mon, 15 Jul 2024 16:13:39 +0700 Subject: [PATCH 3/4] Skip test report from fork PR for product --- .github/workflows/product-ci.yaml | 13 +++++++----- .../test-report/product-test-report.yaml | 20 ------------------- 2 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/test-report/product-test-report.yaml diff --git a/.github/workflows/product-ci.yaml b/.github/workflows/product-ci.yaml index a53f8abca8..946911686c 100644 --- a/.github/workflows/product-ci.yaml +++ b/.github/workflows/product-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -28,14 +30,15 @@ jobs: run: mvn clean install -DskipTests -pl product -am - name: Run Maven Test run: mvn test -pl product -am - - name: Upload Unit Test Results - uses: actions/upload-artifact@v4 # upload test results - if: success() || failure() + - name: Unit Test Results + uses: dorny/test-reporter@v1 + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: - name: product-service-unit-test-results # artifact name + name: Product-Service-Unit-Test-Results path: "product/**/surefire-reports/*.xml" + reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f product diff --git a/.github/workflows/test-report/product-test-report.yaml b/.github/workflows/test-report/product-test-report.yaml deleted file mode 100644 index 3a120c996a..0000000000 --- a/.github/workflows/test-report/product-test-report.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: 'product test report' -on: - workflow_run: - workflows: ['product service ci'] # runs after product service ci workflow - types: - - completed -permissions: - contents: read - actions: read - checks: write -jobs: - report: - runs-on: ubuntu-latest - steps: - - uses: dorny/test-reporter@v1 - with: - artifact: product-service-unit-test-results # artifact name - name: Product-Service-Unit-Test-Results - path: 'surefire-reports/*.xml' # Path to test results (inside artifact .zip) - reporter: java-junit # Format of test results \ No newline at end of file From 2e3a682e087e1bb7e0b759616b0006f87c4f22a6 Mon Sep 17 00:00:00 2001 From: khanhtranduy <130121475+khanhtranduy@users.noreply.github.com> Date: Mon, 15 Jul 2024 17:23:56 +0700 Subject: [PATCH 4/4] Skip test report from fork PR --- .github/workflow-template.yaml | 8 ++++---- .github/workflows/backoffice-bff-ci.yaml | 4 +++- .github/workflows/backoffice-ci.yaml | 4 +++- .github/workflows/cart-ci.yaml | 8 ++++---- .github/workflows/customer-ci.yaml | 8 ++++---- .github/workflows/inventory-ci.yaml | 8 ++++---- .github/workflows/location-ci.yaml | 8 ++++---- .github/workflows/media-ci.yaml | 8 ++++---- .github/workflows/order-ci.yaml | 8 ++++---- .github/workflows/payment-ci.yaml | 8 ++++---- .github/workflows/payment-paypal-ci.yaml | 8 ++++---- .github/workflows/promotion-ci.yaml | 8 ++++---- .github/workflows/rating-ci.yaml | 8 ++++---- .github/workflows/search-ci.yaml | 8 ++++---- .github/workflows/storefront-bff-ci.yaml | 4 +++- .github/workflows/storefront-ci.yaml | 4 +++- .github/workflows/tax-ci.yaml | 8 ++++---- 17 files changed, 64 insertions(+), 56 deletions(-) diff --git a/.github/workflow-template.yaml b/.github/workflow-template.yaml index bb1b771aae..a9e916d875 100644 --- a/.github/workflow-template.yaml +++ b/.github/workflow-template.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f {{SERVICE_NAME}} - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Unit-Test-Results path: "{{SERVICE_NAME}}/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f {{SERVICE_NAME}} diff --git a/.github/workflows/backoffice-bff-ci.yaml b/.github/workflows/backoffice-bff-ci.yaml index 2b91824426..d93198770e 100644 --- a/.github/workflows/backoffice-bff-ci.yaml +++ b/.github/workflows/backoffice-bff-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -27,7 +29,7 @@ jobs: - name: Run Maven Build Command run: mvn clean install -DskipTests -f backoffice-bff - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f backoffice-bff diff --git a/.github/workflows/backoffice-ci.yaml b/.github/workflows/backoffice-ci.yaml index a9f30aaec1..7ddb008104 100644 --- a/.github/workflows/backoffice-ci.yaml +++ b/.github/workflows/backoffice-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -35,7 +37,7 @@ jobs: - run: npx prettier --check . working-directory: backoffice - name: SonarCloud Scan - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: SonarSource/sonarcloud-github-action@master with: projectBaseDir: backoffice diff --git a/.github/workflows/cart-ci.yaml b/.github/workflows/cart-ci.yaml index 848710c9a4..17c4a58a5d 100644 --- a/.github/workflows/cart-ci.yaml +++ b/.github/workflows/cart-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -pl cart -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Cart-Service-Unit-Test-Results path: "cart/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -pl cart -am diff --git a/.github/workflows/customer-ci.yaml b/.github/workflows/customer-ci.yaml index 2ef7b2e570..ec77cd7405 100644 --- a/.github/workflows/customer-ci.yaml +++ b/.github/workflows/customer-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f customer - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Customer-Service-Unit-Test-Results path: "customer/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f customer diff --git a/.github/workflows/inventory-ci.yaml b/.github/workflows/inventory-ci.yaml index 2e0e904de4..7869fa30ae 100644 --- a/.github/workflows/inventory-ci.yaml +++ b/.github/workflows/inventory-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f inventory - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Inventory-Service-Unit-Test-Results path: "inventory/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f inventory diff --git a/.github/workflows/location-ci.yaml b/.github/workflows/location-ci.yaml index 04c932c1de..a2d59b3e6a 100644 --- a/.github/workflows/location-ci.yaml +++ b/.github/workflows/location-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f location - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Location-Service-Unit-Test-Results path: "location/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f location diff --git a/.github/workflows/media-ci.yaml b/.github/workflows/media-ci.yaml index 6225e9e784..42f235d770 100644 --- a/.github/workflows/media-ci.yaml +++ b/.github/workflows/media-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f media - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Media-Service-Unit-Test-Results path: "media/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f media diff --git a/.github/workflows/order-ci.yaml b/.github/workflows/order-ci.yaml index 522a061a18..0a4547292c 100644 --- a/.github/workflows/order-ci.yaml +++ b/.github/workflows/order-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -pl order -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Order-Service-Unit-Test-Results path: "order/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f order diff --git a/.github/workflows/payment-ci.yaml b/.github/workflows/payment-ci.yaml index d316bbbc48..68f646f9d6 100644 --- a/.github/workflows/payment-ci.yaml +++ b/.github/workflows/payment-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -pl payment -am - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Payment-Service-Unit-Test-Results path: "payment/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f payment diff --git a/.github/workflows/payment-paypal-ci.yaml b/.github/workflows/payment-paypal-ci.yaml index d5dae65156..f33b7b4575 100644 --- a/.github/workflows/payment-paypal-ci.yaml +++ b/.github/workflows/payment-paypal-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f payment-paypal - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Payment-Paypal-Unit-Test-Results path: "payment-paypal/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f payment-paypal diff --git a/.github/workflows/promotion-ci.yaml b/.github/workflows/promotion-ci.yaml index 5eaee1d8a9..af62379d3f 100644 --- a/.github/workflows/promotion-ci.yaml +++ b/.github/workflows/promotion-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f promotion - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Promotion-Service-Unit-Test-Results path: "promotion/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f promotion diff --git a/.github/workflows/rating-ci.yaml b/.github/workflows/rating-ci.yaml index 33358669bb..a4b9070f9a 100644 --- a/.github/workflows/rating-ci.yaml +++ b/.github/workflows/rating-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f rating - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Rating-Service-Unit-Test-Results path: "rating/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f rating diff --git a/.github/workflows/search-ci.yaml b/.github/workflows/search-ci.yaml index ec29f10b0c..19be25953b 100644 --- a/.github/workflows/search-ci.yaml +++ b/.github/workflows/search-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f search - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Search-Service-Unit-Test-Results path: "search/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f search diff --git a/.github/workflows/storefront-bff-ci.yaml b/.github/workflows/storefront-bff-ci.yaml index fce73cb434..b98d9a7053 100644 --- a/.github/workflows/storefront-bff-ci.yaml +++ b/.github/workflows/storefront-bff-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -27,7 +29,7 @@ jobs: - name: Run Maven Build Command run: mvn clean install -DskipTests -f storefront-bff - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f storefront-bff diff --git a/.github/workflows/storefront-ci.yaml b/.github/workflows/storefront-ci.yaml index 1a3b3192a2..3d4e5755db 100644 --- a/.github/workflows/storefront-ci.yaml +++ b/.github/workflows/storefront-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -35,7 +37,7 @@ jobs: - run: npx prettier --check . working-directory: storefront - name: SonarCloud Scan - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} uses: SonarSource/sonarcloud-github-action@master with: projectBaseDir: storefront diff --git a/.github/workflows/tax-ci.yaml b/.github/workflows/tax-ci.yaml index 36c21f3e9e..ad496a055b 100644 --- a/.github/workflows/tax-ci.yaml +++ b/.github/workflows/tax-ci.yaml @@ -19,6 +19,8 @@ on: jobs: Build: runs-on: ubuntu-latest + env: + FROM_ORIGINAL_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v3 with: @@ -30,15 +32,13 @@ jobs: run: mvn test -f tax - name: Unit Test Results uses: dorny/test-reporter@v1 - if: | - ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} && - (success() || failure()) + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' && (success() || failure()) }} with: name: Tax-Service-Unit-Test-Results path: "tax/**/surefire-reports/*.xml" reporter: java-junit - name: Analyze with sonar cloud - if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.ref == 'refs/heads/main' }} + if: ${{ env.FROM_ORIGINAL_REPOSITORY == 'true' }} env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -f tax