Skip to content

Commit

Permalink
Add pagination to appropriate listWorkflowRunArtifacts call (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbie-unlikelyai authored Feb 13, 2023
1 parent 5004d54 commit b59d8c6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,33 @@ jobs:
dry_run: true
- name: Test
run: test ${{ steps.download.outputs.dry_run }} == false
download-with-check-artifacts:
runs-on: ubuntu-latest
needs: wait
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download
uses: ./
with:
workflow: upload.yml
name: artifact
path: artifact
check_artifacts: true
- name: Test
run: cat artifact/sha | grep $GITHUB_SHA
download-with-search-artifacts:
runs-on: ubuntu-latest
needs: wait
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download
uses: ./
with:
workflow: upload.yml
name: artifact
path: artifact
search_artifacts: true
- name: Test
run: cat artifact/sha | grep $GITHUB_SHA
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ async function main() {
continue
}
if (checkArtifacts || searchArtifacts) {
let artifacts = await client.rest.actions.listWorkflowRunArtifacts({
let artifacts = await client.paginate(client.rest.actions.listWorkflowRunArtifacts, {
owner: owner,
repo: repo,
run_id: run.id,
})
if (artifacts.data.artifacts.length == 0) {
if (!artifacts || artifacts.length == 0) {
continue
}
if (searchArtifacts) {
const artifact = artifacts.data.artifacts.find((artifact) => {
const artifact = artifacts.find((artifact) => {
return artifact.name == name
})
if (!artifact) {
Expand Down

0 comments on commit b59d8c6

Please sign in to comment.