Skip to content

Commit 8481bcf

Browse files
committed
Correctly format ISO 8601 time
1 parent 9887d8d commit 8481bcf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

services/migrations/github.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,10 @@ func (g GithubDownloaderV3) GetAllNewComments(page, perPage int, updatedAfter ti
802802

803803
// GetNewPullRequests returns pull requests after the given time according page and perPage
804804
func (g *GithubDownloaderV3) GetNewPullRequests(page, perPage int, updatedAfter time.Time) ([]*base.PullRequest, bool, error) {
805-
// Every pull request is an issue, and only Issues API provides parameter `since`,
806-
// So we should get issues IDs first and then get pull requests
805+
// Pulls API doesn't have parameter `since`, so we have to use Search API instead.
806+
// By specifying `repo:owner/repo is:pr` in the query, we can get all pull requests of the repository.
807+
// In addition, we can specify `updated:>=YYYY-MM-DDTHH:MM:SS+00:00` to get pull requests updated after the given time.
808+
807809
if perPage > g.maxPerPage {
808810
perPage = g.maxPerPage
809811
}
@@ -823,7 +825,7 @@ func (g *GithubDownloaderV3) GetNewPullRequests(page, perPage int, updatedAfter
823825
if !updatedAfter.IsZero() {
824826
// timezone denoted by plus, rather than 'Z',
825827
// 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
826-
timeStr := updatedAfter.Format("2006-01-02T15:04:05+07:00")
828+
timeStr := updatedAfter.Format("2006-01-02T15:04:05-07:00")
827829
searchQuery += fmt.Sprintf(" updated:>=%s", timeStr)
828830
}
829831

0 commit comments

Comments
 (0)