Repository navigation
Add support for issue state reason - #6245
Conversation
| @@ -2,188 +2,280 @@ package close | |||
|
|
|||
There was a problem hiding this comment.
Migrated these tests from old style to new style hence the large number of line changes.
| if features.StateReason { | ||
| lookupFields.Add("stateReason") |
There was a problem hiding this comment.
Do you think it would it be simpler to push this logic into shared.findIssueOrPR?
Example: if findIssueOrPR was invoked with stateReason among fields, use featuredetector to determine whether it's supported, and scrub it out if not. Prior art:
cli/pkg/cmd/pr/shared/finder.go
Lines 142 to 151 in e2e8d69
This way, all callers of findIssueOrPR across all commands would not have to worry about GHES not supporting certain fields.
The only gotcha would be that a fd.Detector would have to be passed down as an injectable, though 🤔 Feel free to disregard if that's too much hassle.
There was a problem hiding this comment.
I like this idea. I went ahead and implemented it. Luckily (or unluckily) none of our issue tests target GHES so the feature detection here is a no-op and doesn't need to be injected for testing purposes.
There was a problem hiding this comment.
Future tests that target GHES could also just mock out the request instead of having to inject the detector.
27149a6 to
b44c19c
Compare
This PR adds support for issue state reason to various commands:
issue listset color for closed issues according to state reasonissue viewset color for closed issues according to state reasonsearch issuesset color for closed issues according to state reasonissue closeadd--reasonflag to allow closing of issues with a reason.This PR does not add support of searching by issue state reason to
issue listorsearch issues. Both of those commands support custom search queries that can be used to search by issue state reason according to the docs. We can revisit adding in dedicated flags for this later, but I felt as support for issue state reason was only introduced in GHES 3.6 that adding in flags that did not work on all supported GHES versions would be confusing for users of GHES older than 3.6.cc/ @azenMatt
cc/ https://github.com/github/cli/issues/114