Fix usage of download-workflow-run-artifact (#1328)

This commit is contained in:
Bart Louwers
2023-07-10 13:52:06 +02:00
committed by GitHub
parent 05de15eeeb
commit 3237128aa9
2 changed files with 7 additions and 24 deletions

View File

@@ -15,6 +15,8 @@ jobs:
runs-on: ubuntu-22.04
if: github.event.workflow_run.event == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: .github/actions/download-workflow-run-artifact
with:
artifact-name: render-test-result

View File

@@ -10,31 +10,12 @@ jobs:
comment-on-pr:
runs-on: ubuntu-22.04
steps:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
# TODO: de-duplicate with re-usable action
- name: 'Download size-test-result artifact'
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 == "size-test-result"
})[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}/size-test-result.zip`, Buffer.from(download.data));
- uses: actions/checkout@v3
- name: 'Unzip render-test-result artifact'
run: unzip size-test-result.zip
- uses: .github/actions/download-workflow-run-artifact
with:
artifact-name: size-test-result
expect-files: "./pr_number, ./size"
- name: Show directory structure
run: ls -R