Skip to content

Commit

Permalink
use GetTime() upstreamed helper
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 authored and sonjek committed May 30, 2023
1 parent e64c2fa commit b418765
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions services/migrations/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ func (g *GithubDownloaderV3) GetMilestones() ([]*base.Milestone, error) {
milestones = append(milestones, &base.Milestone{
Title: m.GetTitle(),
Description: m.GetDescription(),
Deadline: convertGithubTimestampToTime(m.DueOn),
Deadline: m.DueOn.GetTime(),
State: state,
Created: m.GetCreatedAt().Time,
Updated: convertGithubTimestampToTime(m.UpdatedAt),
Closed: convertGithubTimestampToTime(m.ClosedAt),
Updated: m.UpdatedAt.GetTime(),
Closed: m.ClosedAt.GetTime(),
})
}
if len(ms) < perPage {
Expand Down Expand Up @@ -715,11 +715,11 @@ func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullReq
State: pr.GetState(),
Created: pr.GetCreatedAt().Time,
Updated: pr.GetUpdatedAt().Time,
Closed: convertGithubTimestampToTime(pr.ClosedAt),
Closed: pr.ClosedAt.GetTime(),
Labels: labels,
Merged: pr.MergedAt != nil,
MergeCommitSHA: pr.GetMergeCommitSHA(),
MergedTime: convertGithubTimestampToTime(pr.MergedAt),
MergedTime: pr.MergedAt.GetTime(),
IsLocked: pr.ActiveLockReason != nil,
Head: base.PullRequestBranch{
Ref: pr.GetHead().GetRef(),
Expand Down Expand Up @@ -878,10 +878,3 @@ func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Rev
}
return allReviews, nil
}

func convertGithubTimestampToTime(t *github.Timestamp) *time.Time {
if t == nil {
return nil
}
return &t.Time
}

0 comments on commit b418765

Please sign in to comment.