Update comments

This commit is contained in:
harryzcy 2023-04-08 13:28:11 -04:00
parent 8481bcf623
commit 448ccfd74f
No known key found for this signature in database
GPG Key ID: E3C2287691E40E35
1 changed files with 3 additions and 1 deletions

View File

@ -801,6 +801,7 @@ func (g GithubDownloaderV3) GetAllNewComments(page, perPage int, updatedAfter ti
}
// GetNewPullRequests returns pull requests after the given time according page and perPage
// If `updatedAfter` is zero-valued, it will return all pull requests
func (g *GithubDownloaderV3) GetNewPullRequests(page, perPage int, updatedAfter time.Time) ([]*base.PullRequest, bool, error) {
// Pulls API doesn't have parameter `since`, so we have to use Search API instead.
// By specifying `repo:owner/repo is:pr` in the query, we can get all pull requests of the repository.
@ -823,7 +824,8 @@ func (g *GithubDownloaderV3) GetNewPullRequests(page, perPage int, updatedAfter
searchQuery := fmt.Sprintf("repo:%s/%s is:pr", g.repoOwner, g.repoName)
if !updatedAfter.IsZero() {
// timezone denoted by plus, rather than 'Z',
// GitHub requires time to be later than 1970-01-01, so we should skip `updated` part if it's zero.
// Timezone is denoted by plus/minus UTC offset, rather than 'Z',
// according to https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-by-when-an-issue-or-pull-request-was-created-or-last-updated
timeStr := updatedAfter.Format("2006-01-02T15:04:05-07:00")
searchQuery += fmt.Sprintf(" updated:>=%s", timeStr)