gh issue commands over GraphQL, and gh inside workflows with the job token #324
Intentwhat this change is meant to do
Make gh issue list/view/create/comment/edit/close/reopen/status/search work against Diffinery, and let workflow GITHUB_TOKENs use GraphQL with their REST permissions, as reported on GitHub #4 and #5.
test-bot merged commit 04dacaa into main
Pull request successfully merged and closed
test-bot merged 04dacaa into main
Sign in to join the conversation.
Requested by Can · project thread
#What this changes
Two reports on the GitHub mirror (codician-team/diffinery#4 and #5) found that
gh issue …failed against Diffinery and thatghinside a workflow couldn't use GraphQL at all. This fixes both.repository.issue,issues(states, labels, orderBy, filterBy with assignee, createdBy, mentioned, milestone, since),issueOrPullRequest, Issue nodes, and issue search throughsearch(type: ISSUE | ISSUE_ADVANCED). Mutations:createIssue,updateIssue,closeIssue(with state reason),reopenIssue;addComment, labels and assignees now accept issues too.is:,state:,author:,assignee:,mentions:,label:,milestone:,no:,head:,base:,review-requested:,draft:,sort:, parentheses and OR, and free-text words.GITHUB_TOKENcan call/api/graphql, and each field checks the samepermissions:grant REST uses (issues, pull-requests, contents, metadata). Writes need the matchingwritescope. Public repositories skip the read check, as on REST./api/v3/metareportsinstalled_version: 3.20.0, whichghuses for feature detection. Without itgh issue list --label,--searchandgh workflow runfail with "malformed version".pullRequestsis no longer capped at 100 items.#How it was tested
test/e2e/graphql.test.mjsadds two tests and passes 8/8 locally. The first runs the gh issue query shapes end to end. The second runs a workflow job token withissues: readand checks that the repository and issues are allowed, while pull requests andcreateIssueare refused with the missing scope named.#Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_015ALxdbMU5hpZXjGpL2jhC4