fix: workflow job list pagination to handle large job counts #478
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, obtaining the job ID via gh CLI would fail when in a workflow with a job count that exceeds 100. For example, in a workflow with 105 jobs, the last 5 jobs fail to obtain their ids, because the 100-sized page didn't include them.
This PR fixes the issue by using the
--paginate
flag to list all of the jobs even when they exceed 100 jobs. It uses the built-in pagination feature of the CLI that allows for using multiple pages under the hood when necessary, while still surfacing the output JSON as a single list (not split by pages).This allows for workflows with arbitrarily-many jobs, at least up to the theoretical limits of how many JSON bytes we can pass around as a string inside our bash commands here.