Skip to content

Commit 448ccfd

Browse files
committed
Update comments
1 parent 8481bcf commit 448ccfd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

services/migrations/github.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ func (g GithubDownloaderV3) GetAllNewComments(page, perPage int, updatedAfter ti
801801
}
802802

803803
// GetNewPullRequests returns pull requests after the given time according page and perPage
804+
// If `updatedAfter` is zero-valued, it will return all pull requests
804805
func (g *GithubDownloaderV3) GetNewPullRequests(page, perPage int, updatedAfter time.Time) ([]*base.PullRequest, bool, error) {
805806
// Pulls API doesn't have parameter `since`, so we have to use Search API instead.
806807
// 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
823824

824825
searchQuery := fmt.Sprintf("repo:%s/%s is:pr", g.repoOwner, g.repoName)
825826
if !updatedAfter.IsZero() {
826-
// timezone denoted by plus, rather than 'Z',
827+
// GitHub requires time to be later than 1970-01-01, so we should skip `updated` part if it's zero.
828+
// Timezone is denoted by plus/minus UTC offset, rather than 'Z',
827829
// 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
828830
timeStr := updatedAfter.Format("2006-01-02T15:04:05-07:00")
829831
searchQuery += fmt.Sprintf(" updated:>=%s", timeStr)

0 commit comments

Comments
 (0)