Commit graph

124 commits

Author SHA1 Message Date
Kynan Ware
3c00ffdade refactor(pr shared): consolidate ActorAssignees and ActorReviewers into ApiActorsSupported
The CLI had two per-entity flags (ActorAssignees on EditableAssignees and
IssueMetadataState, ActorReviewers on IssueMetadataState) threaded through
different layers of the stack to distinguish github.com from GHES. Both
flags were always set from the same source (issueFeatures.ActorIsAssignable)
and never had different values, but they were carried independently on
different structs. This led to a confusing asymmetry where:

- EditableAssignees had ActorAssignees but EditableReviewers had nothing
- The PR edit flow piggybacked on editable.Assignees.ActorAssignees to
  make reviewer mutation decisions, which was misleading
- RepoMetadataInput only had ActorAssignees with no reviewer equivalent

This commit replaces all per-entity flags with a single ApiActorsSupported
bool hoisted to the shared level on Editable, IssueMetadataState, and
RepoMetadataInput. Both assignees and reviewers now key off the same signal.

Every branch site is marked with // TODO ApiActorsSupported so we can grep
for cleanup sites when GHES eventually supports the actor-based mutations
(replaceActorsForAssignable, requestReviewsByLogin).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-24 21:04:41 -06:00
Kynan Ware
e6d9019bc9 fix(pr create): use login-based assignee mutation on github.com
When ActorAssignees is true (github.com), pass assignee logins directly
to the ReplaceActorsForAssignable mutation instead of resolving logins
to node IDs. This eliminates the need to bulk fetch all assignable
users/actors and fixes a bug where providing assignees via CLI flag
and then interactively adding metadata would fail with 'not found'
because the cached MetadataResult had no assignee data.

Changes:
- Set state.ActorAssignees = true in pr create (was missing)
- AddMetadataToIssueParams: pass assigneeLogins when ActorAssignees
  is true, skip fetch and ID resolution entirely
- CreatePullRequest/IssueCreate: call ReplaceActorsForAssignableByLogin
  after creation to assign via logins
- Consolidate replaceActorsForAssignable mutation into api/ package
  (ReplaceActorsForAssignableByLogin + ReplaceActorsForAssignableByID)
- Remove duplicate replaceActorAssigneesForEditable from editable_http.go
- Add TODO replaceActorsByLoginCleanup markers on edit paths

Fixes cli/cli#13000

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-23 15:21:20 -06:00
Kynan Ware
7198d270b4 Add generic actorDisplayName for all actor display names
Replace copilotDisplayName with actorDisplayName(typeName, login, name)
which handles all actor types: known bots get friendly names (e.g.
Copilot → 'Copilot (AI)'), regular bots return login, users with
names return 'login (Name)', others return login.

All DisplayName() methods on Author, CommentAuthor, GitHubUser,
AssignableUser, AssignableBot, RequestedReviewer, and ReviewerBot
now delegate to actorDisplayName with their available fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 11:55:09 -07:00
Andy Feller
7851c9c664 Update gh issue view to show v2 projects
These changes enhance the existing `gh issue view` experience by listing v2 projects in interactive and non-interactive forms.

Additionally, the tests have been enhanced to use a more standard `httpStubs` approach from other tests.
2025-08-12 16:18:45 -04:00
Kynan Ware
9a5ea87d75 fix(issues): fix non-interactive assignee matching to logins&IDs 2025-05-15 09:56:35 -06: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
1e5c3c7426 fix(issue edit): revert rename of ActorAssignees 2025-05-13 13:02:20 -06:00
Kynan Ware
35792827ad refactor(issue edit): rename AssignedActors to ActorAssignees 2025-05-13 07:09:04 -06:00
Kynan Ware
e0afc91fef chore(issue edit): comments cleanup 2025-05-09 23:02:15 -06:00
Kynan Ware
38e52db377 feat(issue edit): fetch currently assigned actors 2025-05-09 15:12:07 -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
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
e775bc64b8 Fix PR and Issue list
Separate the GQL and JSON decoded types that we use for queries.
2023-11-27 17:00:10 +01:00
Sam Coe
e843349a13 Extract Project Status into fragment to fix unmarshal error 2023-11-27 15:01:22 +01:00
Sam Coe
3f37d7e372
Fix query for project item status field (#8332) 2023-11-14 17:27:50 +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
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ć
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
5a6b4ce934 Merge remote-tracking branch 'origin/trunk' into gh-issue-lock 2022-12-16 10:10:59 -08:00
vilmibm
84a15d0943 Merge remote-tracking branch 'origin/trunk' into add-more-author-infomation 2022-12-07 11:54:55 -08:00
chemotaxis
8cdff1327c Merge remote-tracking branch 'upstream/trunk' into gh-issue-lock
Resolved conflicts mainly around pinning comments.
2022-11-13 19:12:19 -05:00
Seito Tanaka
e523d50176
Add support for editing last issue/pr comment (#6384) 2022-10-18 08:10:12 +00:00
Sam Coe
e14d14cef2
Add support for issue state reason (#6245) 2022-09-14 12:39:15 +04:00
ffalor
665e4e3446
Add new commands issue pin and issue unpin (#5597) 2022-08-31 10:16:45 +00:00
chemotaxis
4f37c54ca0 Add lock-related values to issue
Add queries for "ActiveLockReason" and "Locked"
2022-04-11 00:38:13 -04:00
chemotaxis
c0f5345c68 Export return values for Issue.Typename
These are needed to know if an issue is an actual issue or a pull
request.
2022-04-11 00:38:13 -04:00
hirasawayuki
86566d8187 Add author information in pr list JSON output 2022-01-16 21:22:31 +09: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ć
c8d5a6be02 Accept pull requests in issue edit argument 2021-11-23 20:39:19 +01:00
Mislav Marohnić
5be6b67ce7 Remove overfetching from issue delete 2021-11-23 19:39:40 +01:00
Mislav Marohnić
f99a149eb2 Improve issue reopen re: overfetching, handling PRs
- `issue reopen` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue reopen` now accepts either issue or pull number as argument.
2021-11-23 19:39:40 +01:00
Mislav Marohnić
07cad386a5 Improve issue close re: overfetching, handling PRs
- `issue close` no longer fetches all issue fields and thus avoids the
  problem when loading failed due to token not having access to projects

- `issue close` now accepts either issue or pull number as argument.
2021-11-23 19:38:55 +01:00
Mislav Marohnić
619333adb6 Avoid using error values to pass information about the search cap 2021-09-06 16:09:18 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
1440fd81a1 Fix broken GraphQL queries due to editing Author struct 2021-05-18 18:35:34 +02:00
Mislav Marohnić
42155c7d2d Export more IDs in issue/pr JSON payload 2021-05-18 18:19:28 +02:00
Mislav Marohnić
bc3bb97c43 Merge remote-tracking branch 'origin' into pr-lookup-refactor 2021-05-17 17:41:38 +02:00
Mislav Marohnić
02a2ed2f73 Add repo view --json export functionality 2021-05-12 17:05:15 +02:00
Cristian Dominguez
796d2e24ef Bring back Closed field 2021-04-30 17:32:16 -03:00
Mislav Marohnić
9bdc63c4ca Eliminate API overfetching in pr commands
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.

Features:

- Each pr command now gets assigned a concept of a Finder. This makes it
  easier to stub the PR in tests without having to stub the underlying
  HTTP calls or git invocations.

- `pr view --web` is much faster since it only fetches the "url" field.

- `pr diff 123` now skips a whole API call where a whole PR was
  unnecessarily preloaded just to access its diff in a subsequent call.

- PullRequestGraphQL query builder is now used to construct queries.

- A bunch of individual commands are now freed of having to know about
  concepts such as BaseRepo, Branch, Config, or Remotes.
2021-04-30 20:34:36 +02:00
Cristian Dominguez
6b49e21295 Improve issue status detection 2021-04-28 00:30:21 -03:00
Mislav Marohnić
a516ee6833 Add issue status --json support 2021-04-13 21:26:26 +02:00
Mislav Marohnić
abe452bb19 Add --json export flag for issues and pull requests
The `--json` flag accepts a list of GraphQL fields to query for and
output in JSON format. To get the list of available flags, run the
command with a blank value for `--json`. Additional `--jq` and
`--template` flags are available just like in `gh api`.
2021-04-13 20:29:31 +02:00
Mislav Marohnić
19ea49b5a9 Move issue list queries to under the issue/list package 2021-04-13 19:25:19 +02:00
Mislav Marohnić
949df38d49 BREAKING: lookup all issue/PR labels with "AND" instead of "OR" combinator
This switches to the Search API whenever labels are specified in `issue
list` or `pr list`. This ensures that the results match those that would
be returned in the web UI.
2021-03-24 18:04:25 +01:00
Mislav Marohnić
80035aa686 💅 cleanup switching to search mode in issue list 2021-03-23 18:08:14 +01:00
Gowtham Munukutla
f791bbdbcb add search feature in listing issues 2021-03-23 18:08:14 +01:00
Sam Coe
4fdf28d8a4
Change behavior of slice flags for issue edit and pr edit commands 2021-02-12 14:42:21 -08:00
Sam Coe
b366802aa1
Edit issue command 2021-02-04 10:54:34 -08:00
Nate Smith
d91b3121c8
Merge pull request #2839 from kevinmbeaulieu/kb/delete-issue-cmd
Add `issue delete` command
2021-01-27 16:41:30 -08:00