Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/github-statsPublic template

Better GitHub statistics images for your profile, with stats from private repos too

License

NotificationsYou must be signed in to change notification settings

jstrieb/github-stats

Repository files navigation

Generate visualizations of GitHub user and repository statistics with GitHubActions. Visualizations can include data for both private repositories, and forrepositories you have contributed to, but do not own.

Generated images automatically switch between GitHub light theme and GitHubdark theme.

Background

When someone views a profile on GitHub, it is often because they are curiousabout a user's open source projects and contributions. Unfortunately, thatuser's stars, forks, and pinned repositories do not necessarily reflect thecontributions they make to private repositories. The data likewise does notpresent a complete picture of the user's total contributions beyond the currentyear.

This project aims to collect a variety of profile and repository statisticsusing the GitHub API. It then generates images that can be displayed inrepository READMEs, or in a user'sProfileREADME.

Since the project runs on GitHub Actions, no server is required to regularlyregenerate the images with updated statistics. Likewise, since the user runsthe analysis code themselves via GitHub Actions, they can use their GitHubaccess token to collect statistics on private repositories that an externalservice would be unable to access.

Disclaimer

If the project is used with an access token that has sufficient permissions toread private repositories, it may leak details about those repositories inerror messages. For example, theaiohttp library—used for asynchronous APIrequests—may include the requested URL in exceptions, which can leak the nameof private repositories. If there is an exception caused byaiohttp, thisexception will be viewable in the Actions tab of the repository fork, andanyone may be able to see the name of one or more private repositories.

Due to some issues with the GitHub statistics API, there are some situationswhere it returns inaccurate results. Specifically, the repository view countstatistics and total lines of code modified are probably somewhat inaccurate.Unexpectedly, these values will become more accurate over time as GitHubcaches statistics for your repositories. Additionally, repositories that werelast contributed to more than a year ago may not be included in the statisticsdue to limitations in the results returned by the API.

For more information on inaccuracies, see issue#2,#3, and#13.

Installation

  1. Create a personal access token (not the default GitHub Actions token) usingthe instructionshere.Personal access token must have permissions:read:user andrepo. Copythe access token when it is generated – if you lose it, you will have toregenerate the token.
    • Some users are reporting that it can take a few minutes for the personalaccess token to work. For more, see#30.
  2. Create a copy of this repository by clickinghere. Note: this isnot the same as forking a copy because it copies everything fresh,without the huge commit history.
  3. Go to the "Secrets" page of your copy of the repository. If this is theREADME of your copy, clickthis link to goto the "Secrets" page. Otherwise, go to the "Settings" tab of thenewly-created repository and go to the "Secrets" page (bottom left).
  4. Create a new secret with the nameACCESS_TOKEN and paste the copiedpersonal access token as the value.
  5. It is possible to change the type of statistics reported by adding otherrepository secrets.
    • To ignore certain repos, add them (in owner/name format e.g.,jstrieb/github-stats) separated by commas to a new secret—created asbefore—calledEXCLUDED.
    • To ignore certain languages, add them (separated by commas) to a newsecret calledEXCLUDED_LANGS. For example, to exclude HTML and TeX youcould set the value tohtml,tex.
    • To show statistics only for "owned" repositories and not forks withcontributions, add an environment variable (under theenv header in themainworkflow)calledEXCLUDE_FORKED_REPOS with a value oftrue.
    • These other values are added as secrets by default to prevent leakinginformation about private repositories. If you're not worried about that,you can change the values directlyin the Actions workflowitself.
  6. Go to theActionsPage and press "RunWorkflow" on the right side of the screen to generate images for the firsttime.
    • The images will be automatically regenerated every 24 hours, but they canbe regenerated manually by running the workflow this way.
  7. Take a look at the images that have been created in thegenerated folder.
  8. To add your statistics to your GitHub Profile README, copy and paste thefollowing lines of code into your markdown content. Change theusernamevalue to your GitHub username.
    ![](https://raw.githubusercontent.com/username/github-stats/master/generated/overview.svg#gh-dark-mode-only)![](https://raw.githubusercontent.com/username/github-stats/master/generated/overview.svg#gh-light-mode-only)
    ![](https://raw.githubusercontent.com/username/github-stats/master/generated/languages.svg#gh-dark-mode-only)![](https://raw.githubusercontent.com/username/github-stats/master/generated/languages.svg#gh-light-mode-only)
  9. Link back to this repository so that others can generate their ownstatistics images.
  10. Star this repo if you like it!

Support the Project

There are a few things you can do to support the project:

  • Star the repository (and follow me on GitHub for more)
  • Share and upvote on sites like Twitter, Reddit, and Hacker News
  • Report any bugs, glitches, or errors that you find

These things motivate me to keep sharing what I build, and they providevalidation that my work is appreciated! They also help me improve theproject. Thanks in advance!

If you are insistent on spending money to show your support, I encourage you toinstead make a generous donation to one of the following organizations. By advocatingfor Internet freedoms, organizations like these help me to feel comfortablereleasing work publicly on the Web.

Related Projects


[8]ページ先頭

©2009-2025 Movatter.jp