@@ -19,7 +19,7 @@ type repositoryWidget struct {
1919 PullRequestsLimit int `yaml:"pull-requests-limit"`
2020 IssuesLimit int `yaml:"issues-limit"`
2121 CommitsLimit int `yaml:"commits-limit"`
22- ExcludeDraftPRs bool `yaml:"exclude-draft-prs "`
22+ ExcludeDraftPRs bool `yaml:"exclude-draft-pull-requests "`
2323 Repository repository `yaml:"-"`
2424}
2525
@@ -113,23 +113,18 @@ type gitHubCommitResponseJson struct {
113113 } `json:"commit"`
114114}
115115
116- func buildPRQuery (repo string , excludeDraftPRs bool ) string {
117- query := fmt .Sprintf ("is:pr+is:open+repo:%s" , repo )
118- if excludeDraftPRs {
119- query += "+-is:draft"
120- }
121- return query
122- }
123-
124116func fetchRepositoryDetailsFromGithub (repo string , token string , maxPRs int , maxIssues int , maxCommits int , excludeDraftPRs bool ) (repository , error ) {
125117 repositoryRequest , err := http .NewRequest ("GET" , fmt .Sprintf ("https://api.github.com/repos/%s" , repo ), nil )
126118 if err != nil {
127119 return repository {}, fmt .Errorf ("%w: could not create request with repository: %v" , errNoContent , err )
128120 }
129121
130- prQuery := buildPRQuery (repo , excludeDraftPRs )
122+ RRsQuery := fmt .Sprintf ("is:pr+is:open+repo:%s" , repo )
123+ if excludeDraftPRs {
124+ RRsQuery += "+-is:draft"
125+ }
131126
132- PRsRequest , _ := http .NewRequest ("GET" , fmt .Sprintf ("https://api.github.com/search/issues?q=%s&per_page=%d" , prQuery , maxPRs ), nil )
127+ PRsRequest , _ := http .NewRequest ("GET" , fmt .Sprintf ("https://api.github.com/search/issues?q=%s&per_page=%d" , RRsQuery , maxPRs ), nil )
133128 issuesRequest , _ := http .NewRequest ("GET" , fmt .Sprintf ("https://api.github.com/search/issues?q=is:issue+is:open+repo:%s&per_page=%d" , repo , maxIssues ), nil )
134129 CommitsRequest , _ := http .NewRequest ("GET" , fmt .Sprintf ("https://api.github.com/repos/%s/commits?per_page=%d" , repo , maxCommits ), nil )
135130
0 commit comments