XAMPPRocky / octocrab

A modern, extensible GitHub API Client for Rust.
Other
1.06k stars 260 forks source link

Add `Merged` and `Unmerged` state #179

Open spenserblack opened 2 years ago

spenserblack commented 2 years ago

Pull requests have more states than Open and Closed. A closed PR is any PR that isn't open, regardless of whether or not it was merged. Not all closed PRs are merged.

The merged state is supported by the GitHub CLI's gh pr list, for example.

The unmerged state includes open PRs, closed PRs that weren't merged, and drafts.

Example

spenserblack commented 2 years ago

These states can actually be combined. E.g. closed and unmerged PRs.

ghost commented 2 years ago

@spenserblack I believe that GitHub uses the merged_at attribute in order to separate 'closed' and 'merged'. The state for the pr itself is always 'closed'. Therefore the valid states that are also collected in IssueState are ['closed', 'active'].

spenserblack commented 2 years ago

Perhaps I'm wrong in requesting these as "states", but I believe that it is useful to be able to get a list of PRs by their merged/unmerged status. This concept exists for the PullRequestHandler, but I believe that, if possible, the ListPullRequestHandler should be able to filter to status merged/unmerged, and not just state open/closed.

spenserblack commented 2 years ago

It should be noted that the official GitHub CLI tool does refer to "merged" as a state