https://github.com/jonasdoesthings/github-contributions
A library for fetching a GitHub user's contribution graph.
https://github.com/jonasdoesthings/github-contributions
contributions-graph github github-contribution-graph github-contributions scraping typescript-library
Last synced: 5 months ago
JSON representation
A library for fetching a GitHub user's contribution graph.
- Host: GitHub
- URL: https://github.com/jonasdoesthings/github-contributions
- Owner: JonasDoesThings
- License: mit
- Created: 2023-02-07T18:08:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T19:27:11.000Z (over 1 year ago)
- Last Synced: 2025-03-18T09:21:40.403Z (10 months ago)
- Topics: contributions-graph, github, github-contribution-graph, github-contributions, scraping, typescript-library
- Language: TypeScript
- Homepage:
- Size: 267 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-contributions
**A simple TypeScript library to fetch GitHub's contribution chart for a user**
[](./LICENSE)
[](https://www.npmjs.com/package/@jonasdoesthings/github-contributions/)
## Installation
`npm install @jonasdoesthings/github-contributions`
or
`yarn add @jonasdoesthings/github-contributions`
## Usage
```typescript
import {fetchContributions} from '@jonasdoesthings/github-contributions';
fetchContributions("JonasDoesThings").then((contributionsYear) => {
console.log(contributionsYear);
console.log(contributionsYear.contributions[14].numberOfContributions);
});
fetchContributions("JonasDoesThings", 2021).then((contributionsYear) => {
console.log(contributionsYear.totalNumberOfContributions);
console.log(contributionsYear.contributions.find((day) => day.date === '2021-08-29')?.numberOfContributions);
});
```
## API
`fetchContributions(username [string], )`
Returns: `Promise`.
See [src/types/contribution_year.ts](src/types/contribution_year.ts) for the type definition.
## Testing
Run `yarn test` to execute all tests.
## License
The project is licensed under the MIT license.
Check the [LICENSE](./LICENSE) file, for the full legal-notice.