From dcdb805523aaf21fd94c122a6e5516eeb85d19e3 Mon Sep 17 00:00:00 2001
From: Diogo Mendes <diogo@metabase.com>
Date: Tue, 3 May 2022 15:35:04 -0300
Subject: [PATCH] Fix Trivy artifact logic (#22389)

* Adding same logic to upload

* Adding missing line
---
 .github/workflows/uberjar.yml | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/uberjar.yml b/.github/workflows/uberjar.yml
index 08bed71b8bf..bbe22f8cf4a 100644
--- a/.github/workflows/uberjar.yml
+++ b/.github/workflows/uberjar.yml
@@ -151,7 +151,20 @@ jobs:
         format: sarif
         output: trivy-results.sarif
 
-    - name: Upload Trivy scan results to GitHub Security tab
+    - name: Upload Trivy scan results to GitHub Security tab if master or main (ee)
+      if: ${{ (github.ref_name == 'master' || github.ref_name == 'main') && matrix.edition == 'ee' }}
+      uses: github/codeql-action/upload-sarif@v2
+      with:
+        sarif_file: 'trivy-results.sarif'
+
+    - name: Upload Trivy scan results to GitHub Security tab if master or main (oss)
+      if: ${{ (github.ref_name == 'master' || github.ref_name == 'main') && matrix.edition == 'oss' }}
+      uses: github/codeql-action/upload-sarif@v2
+      with:
+        sarif_file: 'trivy-results.sarif'
+
+    - name: Upload Trivy scan results to GitHub Security tab  if dev branch
+      if: ${{ !(startsWith(github.ref_name,'master') || startsWith(github.ref_name,'main') || startsWith(github.ref_name,'backport')) && matrix.edition == 'ee' }}
       uses: github/codeql-action/upload-sarif@v2
       with:
         sarif_file: 'trivy-results.sarif'
-- 
GitLab