Skip to content

Conversation

@ReenigneArcher
Copy link
Member

Description

Add an individual contributions provider for GitHub.

Screenshot

image

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
6 New issues
2 Security Hotspots
6 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (d4e3c8e) to head (b64f176).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@     Coverage Diff      @@
##   master   #18   +/-   ##
============================
============================

Copy link
Member Author

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also add an option to set an upper limit to contributions or view them logarithmic, so that one org doesn't end up overtaking everything. radiusMax does not seem to handle this correctly.

- [**CrowdIn**](https://crowdin.com)
- [**GitHub**](https://github.com)
- [**GitHub Contributors**](https://github.com) (contributors to a specific repository)
- [**GitHub Contributions**](https://github.com) (commit-only contributions aggregated by repository owner across all repos for a single user)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [**GitHub Contributions**](https://github.com) (commit-only contributions aggregated by repository owner across all repos for a single user)
- [**GitHub Contributions**](https://github.com) (merged PRs aggregated by repository owner across all repos for a single user)

Comment on lines +55 to +59
; Optional tuning:
; Retry attempts for transient errors (5xx), default 3
CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRIES=3
; Initial retry delay in ms, default 500 (exponential backoff with jitter)
CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRY_DELAY_MS=500
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
; Optional tuning:
; Retry attempts for transient errors (5xx), default 3
CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRIES=3
; Initial retry delay in ms, default 500 (exponential backoff with jitter)
CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRY_DELAY_MS=500

Not necessary.

1. **contributionsCollection** - Yearly commit timeline (full history) for discovering repositories you have committed to
2. **Search API** - Repositories where you have merged PRs (`is:pr is:merged author:login`)
- When an owner has only one repo, the link points to that repo; otherwise to the owner profile
- Better metric than commits as it represents completed, reviewed contributions
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Better metric than commits as it represents completed, reviewed contributions

Comment on lines +63 to +64
retries: Number(process.env.CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRIES) || 3,
retryDelayMs: Number(process.env.CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRY_DELAY_MS) || 500,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
retries: Number(process.env.CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRIES) || 3,
retryDelayMs: Number(process.env.CONTRIBKIT_GITHUB_CONTRIBUTIONS_RETRY_DELAY_MS) || 500,

Comment on lines +13 to +15
// Ensure unique clipPath id per element. Previously, we only hashed the image bytes,
// which caused duplicates when many items shared the same avatar. Include geometry too.
const cropId = `c${crypto.createHash('md5').update(`${x}:${y}:${size}:${radius}:${base64Image}`).digest('hex').slice(0, 6)}`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Ensure unique clipPath id per element. Previously, we only hashed the image bytes,
// which caused duplicates when many items shared the same avatar. Include geometry too.
const cropId = `c${crypto.createHash('md5').update(`${x}:${y}:${size}:${radius}:${base64Image}`).digest('hex').slice(0, 6)}`
// Unique clipPath id per element, ensuring duplicated images are properly rendered.
const cropId = `c${crypto.createHash('md5').update(`${x}:${y}:${size}:${radius}:${base64Image}`).digest('hex').slice(0, 6)}`

Comment on lines +13 to +16
{
retries: config.githubContributions?.retries ?? 3,
retryDelayMs: config.githubContributions?.retryDelayMs ?? 500,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
retries: config.githubContributions?.retries ?? 3,
retryDelayMs: config.githubContributions?.retryDelayMs ?? 500,
},

Comment on lines +35 to +44
interface FetchOptions {
retries?: number
retryDelayMs?: number
}

export async function fetchGitHubContributions(
token: string,
login: string,
options: FetchOptions = {},
): Promise<Sponsorship[]> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
interface FetchOptions {
retries?: number
retryDelayMs?: number
}
export async function fetchGitHubContributions(
token: string,
login: string,
options: FetchOptions = {},
): Promise<Sponsorship[]> {
export async function fetchGitHubContributions(
token: string,
login: string,
): Promise<Sponsorship[]> {

Comment on lines +51 to +53
const retries = Math.max(0, options.retries ?? 3)
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 500)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const retries = Math.max(0, options.retries ?? 3)
const retryDelayMs = Math.max(0, options.retryDelayMs ?? 500)

const circles = p(root as any).descendants().slice(1)

// Draw smaller circles last so they appear on top and are not hidden by larger ones
circles.sort((a, b) => a.r - b.r)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test without this change.

Comment on lines +301 to +310
/**
* Number of retries for GitHub GraphQL requests on transient failures (e.g., 5xx).
* @default 3
*/
retries?: number
/**
* Initial retry delay in milliseconds for backoff.
* @default 500
*/
retryDelayMs?: number
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/**
* Number of retries for GitHub GraphQL requests on transient failures (e.g., 5xx).
* @default 3
*/
retries?: number
/**
* Initial retry delay in milliseconds for backoff.
* @default 500
*/
retryDelayMs?: number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants