Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

HttpError: Query must include 'is:issue' or 'is:pull-request' when using a user PAT instead of the default GITHUB_TOKEN #227

Closed
iansan5653 opened this issue Nov 1, 2022 · 0 comments · Fixed by #228

Comments

@iansan5653
Copy link
Contributor

When I pass the action the default workflow GITHUB_TOKEN, checks don't run on the pull request because workflows can't trigger other workflows. This is expected and documented, and the workaround is to use a 'bot' account with a PAT that has access to the repository.

However, it seems that the changesets action is incompatible with PATs because of the way it makes queries. When I pass my PAT to the action, the action fails with:

HttpError: Query must include 'is:issue' or 'is:pull-request'

A look into the API documentation reveals that this is a known restriction:

Note: For user-to-server GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the is:issue or is:pull-request qualifier will receive an HTTP 422 Unprocessable Entity response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the is qualifier, see "Searching only issues or pull requests."

It seems that, when I use a PAT, the interaction is now considered a "user-to-server" request instead of a "server-to-server" request like the default GITHUB_TOKEN.

I think this is a pretty common setup as many users will want CI checks to run on the release PR, so I think the action should support this 'user-to-server' scenario. It seems like a simple solution would be to add is:pull-request to the query and solve this headache (though it remains to be seen if there are any other incompatibilities after this error).

@iansan5653 iansan5653 changed the title HttpError: Query must include 'is:issue' or 'is:pull-request' when using a PAT instead of the default GITHUB_TOKEN HttpError: Query must include 'is:issue' or 'is:pull-request' when using a use PAT instead of the default GITHUB_TOKEN Nov 1, 2022
@iansan5653 iansan5653 changed the title HttpError: Query must include 'is:issue' or 'is:pull-request' when using a use PAT instead of the default GITHUB_TOKEN HttpError: Query must include 'is:issue' or 'is:pull-request' when using a user PAT instead of the default GITHUB_TOKEN Nov 1, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant