GitHub CLI in workflow - Can't get project items #170443
Replies: 5 comments
-
|
You can try the following:
This usually resolves the “empty item list” problem. |
Beta Was this translation helpful? Give feedback.
-
|
This usually happens when the app token doesn’t have the correct Projects (beta) GraphQL scope, even if it looks like it has org/project permissions. Try regenerating the token with updated permissions, re-authenticate in your workflow, and test with a raw GraphQL query like: If that returns items, the issue is with the CLI command - make sure you’re on the latest |
Beta Was this translation helpful? Give feedback.
-
|
Hi @zsloane 👋, This usually happens due to token scope/permission issues or the type of token used when accessing Projects (especially Projects v2). A few things to check: App Token Permissions For Projects v2, you need the read:project or project permission at the organization level (not just the repo). If your app token only has repo-level access, you may be able to read the project metadata but not the items inside. GraphQL vs. gh project item-list Under the hood, gh project item-list calls the GraphQL API. If you’re seeing empty results, try running the GraphQL query manually with gh api graphql to confirm if the API itself is returning empty or if it’s a CLI issue. Check Authentication Context If you’re using an App Installation token, make sure the installation is added to the org that owns the project. Sometimes, switching to a classic PAT (with project and repo scope) works as a test to isolate whether the app token permissions are the problem. Known Change GitHub made some changes to Projects API recently. Some users have reported that their workflows broke until they explicitly re-added projects:read permission in their workflow’s permissions: block. Example:-- Yaml permissions: Adding this to your workflow might fix the issue. If none of that helps, I’d suggest testing the same query locally with a classic PAT — if it works there but not with the app token, then it’s definitely a permissions/scope mismatch on the GitHub App. |
Beta Was this translation helpful? Give feedback.
-
|
Setting |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Body
I am trying to work with projects/issues in a workflow via the GH cli (both with

gh api grapqland viagh project item-list. I have done many similar things before but all of a sudden every time I ask for the items in a project it just get:I am using an app token to authenticate and I have confirmed it has access to the repo that the issues are in as well as the correct permissions:

There are definitely issues in the project so that's not it and if I call
gh issue viewwith one of the issues I know is in the project that works just fine. I can also read all the information about the project such as all the custom fields etc but the items list is just empty.Has anyone ever run in to anything like this? Like I said I have used
gh project item-listin actions with this app authentication before and it worked fine. I might have changed some settings on the app so if anyone can point me in a direction that would be awesomeBeta Was this translation helpful? Give feedback.
All reactions