• Q8_329559
  • 25.9KB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-05-24 04:58
使用GitHub Actions生成GitHub用户和存储库统计信息的可视化。 该项目目前仍在进行中; 总是会有更多有趣的统计数据显示。 背景 当某人在GitHub上查看个人资料时,通常是因为他们对用户的开源项目和贡献感到好奇。 不幸的是,该用户的星号,叉子和固定存储库不一定反映出他们对私有存储库的贡献。 数据同样不能完整显示用户在当年之后的总捐款。 该项目旨在使用GitHub API收集各种配置文件和存储库统计信息。 然后,它将生成可显示在资源库或用户的。 由于该项目在GitHub Actions上运行,因此不需要服务器就可以定期使用更新的统计信息重新生成图像。 同样,由于用户自己通过GitHub Actions运行分析代码,因此他们可以使用GitHub访问令牌收集外部服务将无法访问的私有存储库上的统计信息。 免责声明 如果项目与具有足够权限才能读取私有存储库的访问令牌一起使用,则
  • github-stats-master
  • .github
  • workflows
  • main.yml
  • templates
  • overview.svg
  • languages.svg
  • generate_images.py
  • .gitattributes
  • requirements.txt
  • README.md
  • .gitignore
  • github_stats.py
# [GitHub Stats Visualization](https://github.com/jstrieb/github-stats) ![Generate Stats Images](https://github.com/guendto/github-stats/workflows/Generate%20Stats%20Images/badge.svg) <a href="https://github.com/jstrieb/github-stats" rel='nofollow' onclick='return false;'> ![](https://github.com/jstrieb/github-stats/blob/master/generated/overview.svg) ![](https://github.com/jstrieb/github-stats/blob/master/generated/languages.svg) </a> Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-progress; there will always be more interesting stats to display. ## Background When someone views a profile on GitHub, it is often because they are curious about a user's open source projects and contributions. Unfortunately, that user's stars, forks, and pinned repositories do not necessarily reflect the contributions they make to private repositories. The data likewise does not present a complete picture of the user's total contributions beyond the current year. This project aims to collect a variety of profile and repository statistics using the GitHub API. It then generates images that can be displayed in repository READMEs, or in a user's [Profile README](https://docs.github.com/en/github/setting-up-and-managing-your-github-profile/managing-your-profile-readme). Since the project runs on GitHub Actions, no server is required to regularly regenerate the images with updated statistics. Likewise, since the user runs the analysis code themselves via GitHub Actions, they can use their GitHub access token to collect statistics on private repositories that an external service would be unable to access. ## Disclaimer If the project is used with an access token that has sufficient permissions to read private repositories, it may leak details about those repositories in error messages. For example, the `aiohttp` library—used for asynchronous API requests—may include the requested URL in exceptions, which can leak the name of private repositories. If there is an exception caused by `aiohttp`, this exception will be viewable in the Actions tab of the repository fork, and anyone 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 situations where it returns inaccurate results. Specifically, the repository view count statistics and total lines of code modified are probably somewhat inaccurate. Unexpectedly, these values will become more accurate over time as GitHub caches statistics for your repositories. For more information, see issue [#2](https://github.com/jstrieb/github-stats/issues/2) and [#3](https://github.com/jstrieb/github-stats/issues/3). # Installation <!-- TODO: Add details and screenshots --> 1. Create a personal access token (not the default GitHub Actions token) using the instructions [here](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). Personal access token must have permissions: `read:user` and `repo`. Copy the access token when it is generated – if you lose it, you will have to regenerate the token. 2. Click [here](https://github.com/jstrieb/github-stats/generate) to create a fork of this repository 3. If this is the README of your fork, click [this link](../../settings/secrets/actions) to go to the "Secrets" page. Otherwise, go to the "Settings" tab of the newly-created repository and go to the "Secrets" page (bottom left). 4. Create a new secret with the name `ACCESS_TOKEN` and paste the copied personal access token as the value. 5. If you want to ignore certain repos, add them (separated by commas) to a new secret—created as before—called `EXCLUDED`. If you want to ignore certain languages, add them (separated by commas) to a new secret called `EXCLUDED_LANGS`. 6. Go to the [Actions Page](../../actions?query=workflow%3A"Generate+Stats+Images") and press "Run Workflow" on the right side of the screen to generate images for the first time. The images will be periodically generated every hour, but they can be manually regenerated by manually running the workflow. 7. Check out the images that have been created in the [`generated`](generated) folder. 8. Link back to this repository so that others can generate their own statistics images. 9. Star this repo if you like it! # Related Projects - Inspired by a desire to improve upon [anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats) - Makes use of [GitHub Octicons](https://primer.style/octicons/) to precisely match the GitHub UI