Add option to exclude draft pull requests from repository
- Dominant language
- Go
- Stars
- 37.1k
- Forks
- 1.5k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
### Description
Currently, the repository widget fetches all open pull requests from GitHub, including draft PRs. Draft pull requests are often work-in-progress and may not be ready for review, which can create noise in the widget display.
**What problem would this feature solve?**
When monitoring a repository, users typically want to see pull requests that are actually ready for review rather than all open PRs including drafts. Draft PRs represent work-in-progress that may not be actionable by reviewers, so including them can:
- Create visual clutter in the widget
- Make it harder to identify PRs that actually need attention
- Provide misleading information about the repository's review workload
**Proposed solution**
Add a new configuration option `exclude-draft-prs` (or similar) to the repository widget that allows users to filter out draft pull requests from the display.
**Configuration example**
```yaml
- type: repository
repository: owner/repo
token: ${GITHUB_TOKEN}
pull-requests-limit: 5
exclude-draft-prs: true # New option - defaults to false for backward compatibility
```
**Implementation details**
The GitHub Search API already supports excluding draft PRs using the `-is:draft` qualifier. The current query:
```
is:pr+is:open+repo:%s
```
Would become:
```
is:pr+is:open+repo:%s-is:draft
```
when the option is enabled.
**Are there any potential downsides?**
- Minimal - this is an optional feature that defaults to current behavior
- Users who want to see draft PRs can simply leave the option unset or set it to `false
**Implementation location**
The change would primarily affect the `fetchRepositoryDetailsFromGithub` function in `internal/glance/widget-repository.go`, specifically the PR search query construction around line 105.
This feature would enhance the widget's usability by allowing users to focus on actionable pull requests while maintaining backward compatibility with existing configurations.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in internal/glance/widget-repository.go at fetchRepositoryDetailsFromGithub and the PR search query construction around line 105. Trace how repository widget configuration is represented, then verify that the new option preserves the current query by default and excludes draft pull requests when enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 65/100