Commit graph

58 commits

Author SHA1 Message Date
Kynan Ware
a78bedb772 Wrap relationship JSON output in {nodes, totalCount}, fetch full pages
The subIssues, blockedBy, and blocking JSON output is currently shaped
as a flat array, which silently truncates when there are more entries
than the GraphQL fragment fetches. That's misleading once a user
crosses the page size, so this switches each connection to a
{nodes, totalCount} object so consumers can see when there's more.

While confirming page sizes, the GitHub limits turn out to be:

- sub-issues: up to 100 per parent
  https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/adding-sub-issues
- blocked-by / blocking: up to 50 per relationship type
  https://github.blog/changelog/2025-08-21-dependencies-on-issues/

So subIssues moves to first:100 to fetch the full set; blockedBy and
blocking stay at first:50, which already covers their cap.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 16:05:07 -06:00
Kynan Ware
20105edbcb Include id in linked-issue JSON exports
Add id to the GraphQL fragment for subIssues, blockedBy, and blocking
nodes so the canonical node identifier is fetched, and surface it in
the JSON output alongside number/title/url/state for parent, subIssues,
blockedBy, and blocking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-06 15:54:39 -06:00
Kynan Ware
c00bc6a9b4 fix: address code review findings from multi-model review
Critical fixes:
- GHES data-flow regression: blockedBy/blocking fields now
  conditionally added to view lookupFields only when
  IssueRelationshipsSupported is true (GHES 3.19+). Previously
  would break gh issue view on GHES 3.17-3.18.
- State line separator: restore original bullet (•) to avoid
  breaking downstream parsers. Issue type prefix uses middle dot (·).

Optimizations:
- Batch edit --type: resolve issueTypeID once before the loop
  instead of per-goroutine (eliminates N-1 redundant API calls)
- Parent removal: include id in parent GraphQL fragment, use
  issue.Parent.ID directly instead of extra IssueNodeID lookup

Nit fixes:
- Fix formatLinkedIssueRef godoc to match actual behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-30 08:49:43 -06:00
Kynan Ware
c00257386e feat: add Issues 2.0 API types, mutations, and feature detection
Add API infrastructure for issue types, sub-issues, and issue
relationships (blocked-by/blocking):

- New types: IssueType, LinkedIssue, SubIssues, SubIssuesSummary,
  LinkedIssueConnection
- New Issue struct fields for all Issues 2.0 data
- GraphQL query builder cases for new fields
- ExportData cases for JSON output
- Mutation functions: UpdateIssueIssueType, AddSubIssue,
  RemoveSubIssue, AddBlockedBy, RemoveBlockedBy
- Helper functions: RepoIssueTypes, IssueNodeID
- Feature detection: IssueRelationshipsSupported for GHES 3.19+
  (issue types and sub-issues are GA on GHES 3.17+, no detection needed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-30 08:49:43 -06:00
Kynan Ware
5ed8cf0faa fix(pr view): fetch nameWithOwner in headRepository GraphQL query
Commit dd424d85f added NameWithOwner to PRRepository for agent-task
listings but didn't update the headRepository GraphQL query to fetch it.
This caused gh pr view --json headRepository to emit an empty
"nameWithOwner":"" field, breaking the pr-create-respects-simple-
pushdefault acceptance test.

Fetch nameWithOwner in the query and update the test assertion to expect
it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-25 12:47:45 -06:00
yuvrajangadsingh
de61b2b65d feat(pr): add changeType field to files JSON output
Add the changeType field from the PullRequestChangedFile GraphQL type
to the PullRequestFile struct. This exposes the file status (added,
modified, deleted, renamed, copied, changed) in gh pr list --json files
and gh pr view --json files output.

Closes #11385
2026-03-01 15:35:05 +05:30
Simon Taranto
34c3b3c809 Add databaseId to assignees GraphQL fragment
The assignees query fragment only requested id, login, and name but the
GitHubUser struct includes a DatabaseID field. Since the field was never
requested from the API, it always defaulted to Go's zero value (0) in
JSON output. This adds databaseId to the fragment so the actual value is
returned.

Also adds ExportData test cases for assignees on both Issue and
PullRequest to verify databaseId round-trips correctly through JSON
serialization.
2026-02-25 10:26:46 -05:00
Kynan Ware
484526da77 Include name in reviewer display for existing review requests
Fetch name field in reviewRequests GraphQL query and show as 'login (Name)'.
2026-01-29 12:46:26 -07:00
Kynan Ware
738b82ddab Add CCR and reviewer MultiSelectWithSearch
Enables Copilot to be requested as a pull request reviewer, supporting both interactive and non-interactive flows. Introduces new reviewer search functionality, updates reviewer partitioning to distinguish users, bots, and teams, and adds a GraphQL mutation for reviewer management on github.com. Updates help text, tests, and internal APIs to support Copilot reviewer login and display names, while maintaining compatibility with GitHub Enterprise Server.
2026-01-27 23:11:51 -07:00
Kynan Ware
eace1e889a feat(editable): update assigned actors to use display names
- Refactored AssignedActors to return display names instead of logins.
- Updated related functions to ensure consistency in display names.
- Enhanced comments for clarity on display name logic and actor types.
2025-05-14 20:26:53 -06:00
Kynan Ware
261297f0a2 refactor(issue edit): add assignedActors to lookupFields 2025-05-13 07:28:42 -06:00
Azeem Sajid
ee281fd9ba
Add closedByPullRequestsReferences JSON field to issue view (#10941)
* [gh issue view] Expose `closedByPullRequestsReferences` JSON fields

* Incorporate GitHub Copilot review suggestions

* Incorporate review changes
2025-05-07 13:59:22 +01:00
Azeem Sajid
9ed733fa5e
Add closingIssuesReferences JSON field to pr view (#10544)
* [gh pr view] Support `closingIssuesReferences` JSON field

* Support pagination

* Support pagination

* Fix typo

* Add more fields
2025-04-29 11:48:20 +01:00
Dalius Dobravolskas
9414930b5d
Adding option to return baseRefOid in pr view
You need to know exact `baseRefOid` so you could show correct diff.
`baseRefName` is not enough sometimes because branch from which PR was
forked might have changes already.

Example usage:
```
gh pr view --json headRefName,headRefOid,number,baseRefName,baseRefOid,reviewDecision
```
2024-11-19 23:50:45 +02:00
tsukasa inoue
b33e2f92a7
feat: add ArchivedAt field to Repository struct 2024-10-19 11:11:24 +09:00
Yukai Chou
d7b8ecf33d Unify use of tab indent in non-test source files
Found with
    rg '(^ | \t|\t )' -g '*.go' -g '!*_test.go'

Mixed indent exceptions:
- wrapped long list items with extra 2-space indent
- code snippets using space indent
- commented code lines having "\t*// \t+" prefix
2024-08-03 00:35:30 +08:00
William Martin
8a0d361bac Expose fullDatabaseId for PR json export 2024-07-23 13:23:10 +02:00
William Martin
172a9de2fe Ensure PR does not panic when stateReason is requested 2024-07-11 16:30:35 +02:00
nobe4
140edf7327
feat: add support for stateReason in gh pr view (#9080) 2024-05-21 19:54:56 +02:00
Andy Feller
d611ed4bf0 Add missing title field for projectv2 2024-04-29 07:42:53 -04:00
Babak K. Shandiz
985dee0e05
Match query fields with ProjectV2 type
Co-authored-by: Andy Feller <andyfeller@github.com>
2024-04-26 22:59:01 +01:00
Babak K. Shandiz
9e1f9d6101
Include projectsV2 in GraphQL query
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-26 21:06:29 +01:00
Matthew Ruggio
8a868779a6 Add status column for each projectItem object.
This should be comparable to classic project's notion of column, although not _exactly_ the same since new projects are much more configurable.
2023-10-16 21:06:30 -05:00
Sam Coe
ad283cff72
Fix pr checks command for GHES versions older than 3.9 (#7725) 2023-07-19 09:25:07 -07:00
Johannes Grumböck
8a7d80864b
Add check description to pr checks output (#7451) 2023-07-06 14:38:44 +09:00
Sam Coe
d46f47e430
Don't deduplicate checks that stem from different events (#7618) 2023-06-27 09:12:52 +09:00
William Martin
75e35e2dde Use pseudo field for statusCheckRollupWithCountByState 2023-05-22 17:28:15 +02:00
William Martin
ebb7d26f3a Implement initial spike for detecting and using counts by state 2023-05-17 19:59:03 +02:00
Martijn Pieters
bf3ffba8ef
Add PR auto-merge status info to PR queries (#7384) 2023-05-04 09:36:21 +12:00
Yeikel
9b75e274e4
feat: add visibility field (#7337) 2023-04-25 12:58:01 +00:00
Sam Coe
08a1231178
Allow retrieving projectItems in JSON and allow adding/removing user owned projects (#7007) 2023-02-15 22:14:59 +00:00
azu
700bda3ad8
Add gh repo edit --enable-discussions (#6903)
* Add gh repo edit --enable-discussions
* Add hasDiscussionsEnabled to JSON fields for repos

Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-01-24 18:13:05 +01:00
Ilya Yatsishin
179e9c256d
Add projectsV2 support to issue create, issue edit, pr create, and pr edit (#6735)
Co-authored-by: pshevche <pavel.shevchenko.95@gmail.com>
Co-authored-by: Sam Coe <samcoe@users.noreply.github.com>
2023-01-19 22:13:09 +00:00
Mislav Marohnić
8b3e5c1554
Fix mergedBy JSON export for PRs 2023-01-18 21:41:07 +01:00
Mislav Marohnić
8d82a96349
Fix fetching issue/PR comments
The "Author" struct was too overloaded in different types of queries that treat struct fields in incompatible ways. This change defines a simpler CommentAuthor struct for use in comments until we can figure out how to query `... on User` information for comments too.
2022-12-23 17:14:06 +01:00
vilmibm
84a15d0943 Merge remote-tracking branch 'origin/trunk' into add-more-author-infomation 2022-12-07 11:54:55 -08:00
Mislav Marohnić
40cfa90222
Expose commit OID in PR reviews JSON export 2022-11-21 17:25:44 +01:00
Robin Neatherway
0197b51f72
Replace spaces with tabs in mixed whitespace string (#6456)
This makes the indentation of the query consistent no matter your
local tab size rendering.
2022-10-18 11:08:47 +00:00
Seito Tanaka
e523d50176
Add support for editing last issue/pr comment (#6384) 2022-10-18 08:10:12 +00:00
Natthakit Susanthitanon
bb25202054
Add headRefOid to PullRequestFields 2022-10-07 16:16:15 +07:00
Sam Coe
e14d14cef2
Add support for issue state reason (#6245) 2022-09-14 12:39:15 +04:00
ffalor
e5b37ee661
add --required flag to gh pr checks (#5648) 2022-09-10 08:00:29 +00:00
ffalor
665e4e3446
Add new commands issue pin and issue unpin (#5597) 2022-08-31 10:16:45 +00:00
Mislav Marohnić
dea1af1227
pr checks: avoid deduplicating same-named checks under different workflows (#5919) 2022-07-12 09:48:39 +00:00
Des Preston
2e07d0f32c
pr status: show number of approvals (#4240)
If the base branch has no minimum approval requirements, show "N Approved"
reviews. Otherwise, show "N/X Approved".

Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-01-21 15:58:15 +00:00
hirasawayuki
86566d8187 Add author information in pr list JSON output 2022-01-16 21:22:31 +09:00
Mislav Marohnić
0e3c3bb4a4
pr view: ensure that PR reviews are always rendered in --comments mode (#4848)
The GraphQL query for review didn't use to request the `TotalCount`
field, but that field was checked before rendering the conversation
thread in `pr view --comments`. This fixes rendering the conversation
thread when a PR only has reviews but no ordinary comments.
2021-12-03 18:07:27 +01:00
Mislav Marohnić
34fc5fb75c Improve issue view re: overfetching, PR support
- Supports passing a PR as argument, not just issues
- Makes it non-fatal when project cards were not able to load
- Cleans up legacy method for fetching issues
2021-11-24 18:49:36 +01:00
Mislav Marohnić
1eb790cacd Improve issue comment re: overfetching, handling PRs
- `issue comment` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue comment` now accepts either issue or pull number as argument.
2021-11-23 16:40:14 +01:00
Mislav Marohnić
a4d1ce7709 Fix fetching information about the PR potentially being behind base branch 2021-06-10 15:51:27 +02:00