git-hulk commented on code in PR #2048:
URL: https://github.com/apache/kvrocks/pull/2048#discussion_r1464896407


##########
.github/workflows/sonar.yaml:
##########
@@ -39,30 +39,45 @@ jobs:
         uses: actions/github-script@v6
         with:
           script: |
-            let allArtifacts = await 
github.rest.actions.listWorkflowRunArtifacts({
-               owner: context.repo.owner,
-               repo: context.repo.repo,
-               run_id: context.payload.workflow_run.id,
-            });
-            let matchArtifact = allArtifacts.data.artifacts.filter((artifact) 
=> {
-              return artifact.name == "sonarcloud-data"
-            })[0];
-            let download = await github.rest.actions.downloadArtifact({
-               owner: context.repo.owner,
-               repo: context.repo.repo,
-               artifact_id: matchArtifact.id,
-               archive_format: 'zip',
-            });
-            let fs = require('fs');
-            
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/sonarcloud-data.zip`, 
Buffer.from(download.data));
+            async function getData(name) {
+              let allArtifacts = await 
github.rest.actions.listWorkflowRunArtifacts({
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                run_id: context.payload.workflow_run.id,
+              });
+              let matchArtifact = 
allArtifacts.data.artifacts.filter((artifact) => {
+                return artifact.name == name
+              })[0];
+              if(!matchArtifact) return;
+              let download = await github.rest.actions.downloadArtifact({
+                owner: context.repo.owner,
+                repo: context.repo.repo,
+                artifact_id: matchArtifact.id,
+                archive_format: 'zip',
+              });
+              let fs = require('fs');
+              fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${name}.zip`, 
Buffer.from(download.data));
+            }
+            await getData("sonarcloud-data");
+            await getData("pr");

Review Comment:
   OK, thanks for your reference. That said, this artifact is only visible in 
the current run.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to