Skip to content

Commit

Permalink
Use action-download-artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
epompeii committed Oct 6, 2024
1 parent 96ce385 commit 5910b93
Showing 1 changed file with 8 additions and 29 deletions.
37 changes: 8 additions & 29 deletions .github/workflows/track_fork_pr_benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5910b93

Please sign in to comment.