From a3c38bc1f96fddda13c5af18e6e626978bfd1a35 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 16 Jan 2024 16:14:38 -0800 Subject: [PATCH] devops: merge paginated results when downloading blobs (#29013) * The results are paginated by default to return max 30 entries, see [this page](https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28). We use [octakit.paginate](https://octokit.github.io/rest.js/v20#pagination), wrapped into [github-script](https://github.com/actions/github-script/tree/60a0d83039c74a4aee543508d2ffcb1c3799cdea) to automatically load all artifacts urls. * Also bumped github-script to v7 --- .github/actions/download-artifact/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/download-artifact/action.yml b/.github/actions/download-artifact/action.yml index fdcb87b350..d279df5f8d 100644 --- a/.github/actions/download-artifact/action.yml +++ b/.github/actions/download-artifact/action.yml @@ -18,17 +18,17 @@ runs: shell: bash run: mkdir -p '${{ inputs.path }}/artifacts' - name: Download artifacts - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | console.log(`downloading artifacts for workflow_run: ${context.payload.workflow_run.id}`); console.log(`workflow_run: ${JSON.stringify(context.payload.workflow_run, null, 2)}`); - const { data } = await github.rest.actions.listWorkflowRunArtifacts({ + const allArtifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, { ...context.repo, run_id: context.payload.workflow_run.id }); - console.log('total = ', data.total_count); - const artifacts = data.artifacts.filter(a => a.name.startsWith('${{ inputs.namePrefix }}')); + console.log('total = ', allArtifacts.length); + const artifacts = allArtifacts.filter(a => a.name.startsWith('${{ inputs.namePrefix }}')); const fs = require('fs'); for (const artifact of artifacts) { const result = await github.rest.actions.downloadArtifact({