Skip to content

bypass --limit to fetch all issues#9522

Closed
aryanbhosale wants to merge 1 commit into
cli:trunkfrom
aryanbhosale:patch-1
Closed

bypass --limit to fetch all issues#9522
aryanbhosale wants to merge 1 commit into
cli:trunkfrom
aryanbhosale:patch-1

Conversation

@aryanbhosale

Copy link
Copy Markdown
Contributor

Fixes #4888

fetch all issues when limit is 0, and respect the limit otherwise

this change would allow users to easily retrieve all open issues with a command like:
gh issue list --state=open --limit=0 --json=number

@aryanbhosale aryanbhosale requested a review from a team as a code owner August 24, 2024 12:18
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Aug 24, 2024
@andyfeller

andyfeller commented Aug 26, 2024

Copy link
Copy Markdown
Contributor

@aryanbhosale : Thank you for finding ways to contribute to the GitHub CLI! However, the direction of the linked issue is very different than the changes you propose:

Hi, thank you for the feature request, but it is by design that you must always specify the limit for fetching issues, pull request, repositories, or basically any unbounded set of data on GitHub.

Having a "no limit" setting would be convenient but would also be tricky if people started using it in their workflows or scripts without giving it a second thought. For example, fetching all issues without limit from this repository would likely complete in under a minute, but fetching all issues from some other repositories I belong to could potentially take many minutes. For example, the VS Code repository currently has 124,827 issues. Since we can only ever fetch 100 issues per request, we would need 1,249 sequential requests to fetch all of these issues. Now, if you take into account the overhead of making a single API request to GitHub, then multiply that to a thousand, then also consider rate limit restrictions, you can start to understand why unbounded fetching of data over the network is rarely a good idea.

So, if you need to fetch all issues from a large repository, specify a large --limit number to encompass all data that you are interested in. Specifying a large number as a limit forces you to consider what would happen if there actually were enough records to fill that limit.

However, we could document this restriction better, I agree! I'm going to re-classify this as a documentation issue.

As such, I'm closing this PR until we discuss new acceptance criteria within the issue behind this behavior.

@andyfeller andyfeller closed this Aug 26, 2024
@aryanbhosale aryanbhosale deleted the patch-1 branch August 26, 2024 14:22
@aryanbhosale

Copy link
Copy Markdown
Contributor Author

Thank you @andyfeller for you feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update documentation around --limit flag restriction

3 participants