Skip to content

Release Notes v0.13.0

This release upgrades go-github from v84 to v88, adds cross-period aggregation for profile statistics, and expands test coverage for graphql and sarif packages.

Highlights

  • go-github v88: Upgraded from v84 to v88 with updated API patterns
  • Cross-Period Aggregation: New AggregateMonthlyStats function for computing quarterly/yearly statistics
  • Enhanced Test Coverage: Added comprehensive tests for graphql and sarif packages

Breaking Changes

go-github v88 API Changes

The go-github library v88 introduced breaking changes to client creation:

Before (v84):

client := github.NewClient(nil).WithAuthToken(token)

After (v88):

client, err := github.NewClient(github.WithAuthToken(token))
if err != nil {
    return err
}

Key changes:

  • NewClient now returns (*Client, error) instead of *Client
  • WithAuthToken and WithEnterpriseURLs are now ClientOptionsFunc parameters passed to NewClient, not methods on Client

If you use gogithub functions (like auth.NewGitHubClient), this change is handled internally. Direct go-github usage in your code will need updating.

New Features

Cross-Period Aggregation

Aggregate monthly statistics into quarterly or yearly summaries:

import "github.com/grokify/gogithub/profile"

// Get monthly stats for multiple months
months := []profile.MonthlyStats{...}

// Aggregate into quarterly/yearly totals
aggregated := profile.AggregateMonthlyStats(months)

fmt.Printf("Total commits: %d\n", aggregated.Commits)
fmt.Printf("Total additions: %d\n", aggregated.Additions)
fmt.Printf("Unique repositories: %d\n", len(aggregated.Repositories))

New Types

profile.AggregatedStats

type AggregatedStats struct {
    Commits      int
    PRs          int
    Reviews      int
    Issues       int
    Releases     int
    Additions    int
    Deletions    int
    NetAdditions int
    Repositories map[string]bool // Unique repos across all months
}

profile.MonthlyStats.Repositories

The MonthlyStats struct now includes a Repositories field tracking which repos had commits each month:

type MonthlyStats struct {
    Year         int
    Month        int
    MonthName    string
    Commits      int
    // ... other fields ...
    Repositories map[string]bool // Repos with commits this month
}

Tests Added

graphql package

  • Tests for Visibility constants (VisibilityAll, VisibilityPublic, VisibilityPrivate)
  • Tests for MonthlyCommitStats.YearMonth() method
  • Tests for CommitStats and RepoCommitStats structs
  • Tests for monthlyMapToSlice function including sorting
  • Tests for MonthlyContribution.YearMonth() method
  • Tests for ContributionStats struct
  • Tests for mapToMonthlyContributions function with invalid date handling

sarif package

  • Tests for gzipCompress/gzipDecompress with empty, large, and binary data
  • Tests for UploadOptions, UploadResult, and UploadStatus structs
  • Tests for ProcessingStatus comparison

Dependencies

Dependency Previous Current
github.com/google/go-github v84.0.0 v88.0.0
github.com/grokify/mogo v0.74.1 v0.74.6
actions/checkout 6 7

Upgrade Notes

  1. Update imports: Change go-github/v84 to go-github/v88 in your import paths
  2. Handle NewClient errors: github.NewClient() now returns an error
  3. Use option functions: WithAuthToken and WithEnterpriseURLs are now passed to NewClient
go get github.com/grokify/gogithub@v0.13.0

Commits

Type Description Commit
feat Add cross-period aggregation for MonthlyStats d5b8772
chore(deps) Upgrade go-github from v84 to v88 b6058f9
test Add tests for commit stats types dc0b868
test Add tests for contribution stats types b1ea423
test Add tests for gzip compression and upload types a411084