Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,17 @@ async function main() {

console.log("==> RunID:", runID)

let artifacts = await client.actions.listWorkflowRunArtifacts({
let artifacts = await client.paginate(client.actions.listWorkflowRunArtifacts, {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to do this in a loop. See how it is done above.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dawidd6 We could do it in a loop, but it would just be the same as what's going on with the default paginate. The above loop is different since we bail out early once the correct run has been found (vs here, where we would never bail since we always want all artifacts).

@dawidd6 dawidd6 Jul 13, 2021

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, just read the docs. Didn't know about it.

owner: owner,
repo: repo,
run_id: runID,
})
});

// One artifact or all if `name` input is not specified.
if (name) {
artifacts = artifacts.data.artifacts.filter((artifact) => {
artifacts = artifacts.filter((artifact) => {
return artifact.name == name
})
} else {
artifacts = artifacts.data.artifacts
}

if (artifacts.length == 0)
Expand Down