Skip to content

Commit

Permalink
workflows: switch to v4 artifact handling
Browse files Browse the repository at this point in the history
upload-artifact v4 uses a new backend storage implementation.
download-artifact v4 supports downloading artifacts from a different
workflow run, so we can use it to replace the open-coded github-script
invocation.

Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Dec 15, 2023
1 parent 9af12cd commit 0795cc9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
dco-check -v
touch result/success
- name: Upload result
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: result
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/dco-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,16 @@ jobs:
if: ${{ github.event.workflow_run.event == 'pull_request' }}
steps:
- name: Download state
uses: actions/github-script@v7
uses: actions/download-artifact@v4
with:
script: |
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "result"
})[0];
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{ github.workspace }}/result.zip', Buffer.from(download.data));
name: result
path: result
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Read state
id: result
run: |
unzip -d result result.zip
echo "pr=$(cat result/pr)" >> $GITHUB_OUTPUT
echo "base=$(cat result/base)" >> $GITHUB_OUTPUT
echo "head=$(cat result/head)" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 0795cc9

Please sign in to comment.