diff --git a/.github/actions/check_artifact_exists/dist/index.js b/.github/actions/check_artifact_exists/dist/index.js index c33d562f..b20ce52b 100644 Binary files a/.github/actions/check_artifact_exists/dist/index.js and b/.github/actions/check_artifact_exists/dist/index.js differ diff --git a/.github/actions/check_artifact_exists/main.js b/.github/actions/check_artifact_exists/main.js index e7608aa1..b86b5e3e 100644 --- a/.github/actions/check_artifact_exists/main.js +++ b/.github/actions/check_artifact_exists/main.js @@ -8,49 +8,28 @@ const { throttling } = require('@octokit/plugin-throttling'); const { GitHub } = require('@actions/github/lib/utils'); async function getGoodArtifacts(client, owner, repo, name) { - const goodWorkflowArtifacts = await client.paginate( - "GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts", - { - owner: owner, - repo: repo, - run_id: github.context.runId, - }, - (workflowArtifacts) => { - // console.log(" ==> workflowArtifacts", workflowArtifacts); - return workflowArtifacts.data.filter((a) => { - // console.log("==> Artifact check", a); - return a.name == name - }) - } - ); - - console.log("==> maybe goodWorkflowArtifacts:", goodWorkflowArtifacts); - if (goodWorkflowArtifacts.length > 0) { - return goodWorkflowArtifacts; - } - const goodRepoArtifacts = await client.paginate( "GET /repos/{owner}/{repo}/actions/artifacts", { owner: owner, repo: repo, + per_page: 100, }, - (repoArtifacts) => { + (repoArtifacts, done) => { // console.log(" ==> repoArtifacts", repoArtifacts); - return repoArtifacts.data.filter((a) => { + const goodArtifacts = repoArtifacts.data.filter((a) => { // console.log("==> Artifact check", a); return a.name == name - }) + }); + if (goodArtifacts.length > 0) { + done(); + } + return goodArtifacts; } ); console.log("==> maybe goodRepoArtifacts:", goodRepoArtifacts); - if (goodRepoArtifacts.length > 0) { - return goodRepoArtifacts; - } - - // We have not been able to find a repo artifact, it's really no good news - return []; + return goodRepoArtifacts; } async function main() { diff --git a/.github/actions/check_artifact_exists/package-lock.json b/.github/actions/check_artifact_exists/package-lock.json index 3a70ac66..fd188e3c 100644 --- a/.github/actions/check_artifact_exists/package-lock.json +++ b/.github/actions/check_artifact_exists/package-lock.json @@ -79,7 +79,8 @@ "@octokit/openapi-types": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-6.0.0.tgz", - "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==" + "integrity": "sha512-CnDdK7ivHkBtJYzWzZm7gEkanA7gKH6a09Eguz7flHw//GacPJLmkHA3f3N++MJmlxD1Fl+mB7B32EEpSCwztQ==", + "dev": true }, "@octokit/plugin-paginate-rest": { "version": "2.13.3", @@ -104,6 +105,7 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-3.4.1.tgz", "integrity": "sha512-qCQ+Z4AnL9OrXvV59EH3GzPxsB+WyqufoCjiCJXJxTbnt3W+leXbXw5vHrMp4NG9ltw00McFWIxIxNQAzLNoTA==", + "dev": true, "requires": { "@octokit/types": "^6.0.1", "bottleneck": "^2.15.3" @@ -138,6 +140,7 @@ "version": "6.13.0", "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.13.0.tgz", "integrity": "sha512-W2J9qlVIU11jMwKHUp5/rbVUeErqelCsO5vW5PKNb7wAXQVUz87Rc+imjlEvpvbH8yUb+KHmv8NEjVZdsdpyxA==", + "dev": true, "requires": { "@octokit/openapi-types": "^6.0.0" } @@ -163,7 +166,8 @@ "bottleneck": { "version": "2.19.5", "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", - "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==" + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true }, "deprecation": { "version": "2.3.1",