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

gh cli returns different (and incorrect) first entry than what is returned from the ui #9067

Open
yassinm opened this issue May 9, 2024 · 5 comments
Labels
docs feedback help wanted Contributions welcome

Comments

@yassinm
Copy link

yassinm commented May 9, 2024

Describe the bug

A clear and concise description of what the bug is. Include version by typing gh --version.

 -→ gh version
gh version 2.49.1 (2024-05-08)
https://github.com/cli/cli/releases/tag/v2.49.1

 -→ cat /etc/os-release 
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="23.11.6418.e402c3eb6d88"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 23.11 (Tapir)"
SUPPORT_END="2024-06-30"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="23.11 (Tapir)"
VERSION_CODENAME=tapir
VERSION_ID="23.11"

I am trying to find the last issue number in the repo. i use that to create an issue automatically. its alrways returning the wrong results

Steps to reproduce the behavior

  1. Type this gh issue list -L 10 --repo unnug/pf-track --search "sort:created-desc" --json number --jq '.[].number'
  2. View the output
562
332
331
330
329
  1. See error

Expected vs actual behavior

the ui is correctly reporting the right results as per the attached screencshots

Logs

The first entry in descending order should be issue #631 i am not sure why it is returningthe above

image

@yassinm yassinm added the bug Something isn't working label May 9, 2024
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label May 9, 2024
@arunsathiya
Copy link
Contributor

Unless I am misreading something, the UI on your screenshot is showing closed issues while the CLI query is for open issues.

Could you use the --state flag with closed? That should show closed issues, only. Other supported values are open and all

@yassinm
Copy link
Author

yassinm commented May 10, 2024

Unless I am misreading something, the UI on your screenshot is showing closed issues while the CLI query is for open issues.

Could you use the --state flag with closed? That should show closed issues, only. Other supported values are open and all

--state all is what i needed exactly ! as you said the ui is implicitly using closed while the cli is again implicitly using open without telling the user about what the query is implicitly using.

Do you think it would make sense to add a hint on the ui/cli to infomr the user what implicit settings are being passed ?

Bast Regards and thank you sooo much !!!

@williammartin
Copy link
Member

Thanks @arunsathiya for triaging this.

Do you think it would make sense to add a hint on the ui/cli to infomr the user what implicit settings are being passed ?

It's in issue list --help:

-s, --state string Filter by state: {open|closed|all} (default "open")

And if you run gh issue list the green is used to indicate state as well:

Image

That said, I would be open to adding a little extra info in the issue list Long description. Do you think it would have helped you if issue list --help would have said:

List issues in a GitHub repository. By default this only lists open issues.

I'm not that keen to repeat information but I also don't want to ignore someone getting confused.

@williammartin williammartin added docs feedback and removed needs-triage needs to be reviewed bug Something isn't working labels May 10, 2024
@yassinm
Copy link
Author

yassinm commented May 10, 2024

@williammartin thank you so much for this detailed answer and your keen suggestion

what i missed is the --state flag that can be passed.

  1. if you can add an example to the gh issue list --help showing how to use state
  $ gh issue list --state all --search "sort:created-desc"
  1. as you mentioned something along the lines of
List issues in a GitHub repository. By default (if no --state flag is passed)  this only lists open issues.

@williammartin williammartin added the help wanted Contributions welcome label May 10, 2024
@williammartin
Copy link
Member

if you can add an example to the gh issue list --help showing how to use state

Great idea.

I've added the help wanted label if you'd be up for contributing those changes.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs feedback help wanted Contributions welcome
Projects
None yet
Development

No branches or pull requests

5 participants
@williammartin @yassinm @arunsathiya @cliAutomation and others