mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-01 08:34:02 +03:00
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](60a0d83039
)
to automatically load all artifacts urls.
* Also bumped github-script to v7
This commit is contained in:
parent
d023829dd5
commit
a3c38bc1f9
8
.github/actions/download-artifact/action.yml
vendored
8
.github/actions/download-artifact/action.yml
vendored
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user