You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh pr list depends on the read permission for Issues #5986
I haven't been able to investigate this in detail, but isn't it strange that the result of the gh pr list command changes depending on the permissions on Issues?
Steps to reproduce the behavior
The following command with almost all permissions will successfully return pull requests data.
However, when I run the same command on GitHub Action using an access token created by a GitHub App that does not have read permission to Issues (but has read permission to Pull Requests), it always returns an empty array. In the example above, it always returns 0.
Thank you for reporting! I have reported this on the GitHub platform end since it looks like it is a bug with GitHub Search when invoked through GraphQL API. In the meantime, the workaround is to always give issues: read permissions to tokens that need to operate on Pull Requests.
This really stumped me for a while, it would be great if the CLI returned an error if the attempt failed instead of just returned a valid value and exit 0
it was extremely subtle for me. gh pr list returns everything inside the action and gh pr list --json labels works out too, but gh pr list --label <label> returns nothing. so it seems specifically around searching via label.
A workaround I have is to list them all then use -q with a selection query for my label.
what I wanted to do: gh pr list --label mylabel --json headRefName what I did to work around: gh pr list --json labels,headRefName -q '.[] | select(if .labels | .[].name == "mylabel" then true else false end) | .headRefName'
Activity
mislav commentedon Jul 25, 2022
Thank you for reporting! I have reported this on the GitHub platform end since it looks like it is a bug with GitHub Search when invoked through GraphQL API. In the meantime, the workaround is to always give
issues: readpermissions to tokens that need to operate on Pull Requests.h4xnoodle commentedon Sep 3, 2022
This really stumped me for a while, it would be great if the CLI returned an error if the attempt failed instead of just returned a valid value and exit 0
it was extremely subtle for me.
gh pr listreturns everything inside the action andgh pr list --json labelsworks out too, butgh pr list --label <label>returns nothing. so it seems specifically around searching via label.A workaround I have is to list them all then use
-qwith a selection query for my label.what I wanted to do:
gh pr list --label mylabel --json headRefNamewhat I did to work around:gh pr list --json labels,headRefName -q '.[] | select(if .labels | .[].name == "mylabel" then true else false end) | .headRefName'mislav commentedon Oct 24, 2022
This should now be fixed on the platform 🎉