Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pagination to appropriate listWorkflowRunArtifacts call - take 2 #225

30 changes: 30 additions & 0 deletions .github/workflows/download.yml
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
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