From 5910b93e85c2698545036d490fe15424954b3c6c Mon Sep 17 00:00:00 2001 From: Everett Pompeii Date: Sun, 6 Oct 2024 08:32:56 -0400 Subject: [PATCH] Use action-download-artifact https://github.com/dawidd6/action-download-artifact --- .../workflows/track_fork_pr_benchmarks.yml | 37 ++++--------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/.github/workflows/track_fork_pr_benchmarks.yml b/.github/workflows/track_fork_pr_benchmarks.yml index 6f8e12f..134b9a9 100644 --- a/.github/workflows/track_fork_pr_benchmarks.yml +++ b/.github/workflows/track_fork_pr_benchmarks.yml @@ -14,36 +14,15 @@ jobs: PR_EVENT: event.json steps: - name: Download Benchmark Results - uses: actions/github-script@v7 + uses: dawidd6/action-download-artifact@v6 with: - script: | - async function downloadArtifact(artifactName) { - 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 == artifactName - })[0]; - if (!matchArtifact) { - core.setFailed(`Failed to find artifact: ${artifactName}`); - } - 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}/${artifactName}.zip`, Buffer.from(download.data)); - } - await downloadArtifact(process.env.BENCHMARK_RESULTS); - await downloadArtifact(process.env.PR_EVENT); - - name: Unzip Benchmark Results - run: | - unzip $BENCHMARK_RESULTS.zip - unzip $PR_EVENT.zip + name: ${{ env.BENCHMARK_RESULTS }} + run_id: ${{ github.event.workflow_run.id }} + - name: Download PR Event + uses: dawidd6/action-download-artifact@v6 + with: + name: ${{ env.PR_EVENT }} + run_id: ${{ github.event.workflow_run.id }} - name: Export PR Event Data uses: actions/github-script@v7 with: