diff --git a/.github/workflows/download.yml b/.github/workflows/download.yml index 20d7a27b..4e2cd467 100644 --- a/.github/workflows/download.yml +++ b/.github/workflows/download.yml @@ -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 diff --git a/main.js b/main.js index a14c8903..8689ecd2 100644 --- a/main.js +++ b/main.js @@ -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) {