Statistic images for your profile, with stats from private repos too

[CI] Stats generator 8edc311406 [CI] Update stats (23.01.2025 00:06) [SKIP CI] před 1 dnem
generated 8edc311406 [CI] Update stats (23.01.2025 00:06) [SKIP CI] před 1 dnem
templates 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
.gitattributes 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
.gitignore 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
.woodpecker.yaml 9a566e7b5d removed secrets před 2 dny
LICENSE 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
README.md 6e12a8e216 README.md aktualisiert před 8 měsíci
colors.json 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
main.py 885096fb2b fix json read před 2 týdny
requirements.txt 39eb654d9b Start empty to dont spend 5 MB to commit history před 10 měsíci
users.json a1dc094fb9 More users před 10 měsíci

README.md

Forgejo / Gitea Stats Visualization

status-badge license badge Stars Issues

⇣ use this ⇣


Generate visualizations of Forgejo / Gitea user and repository statistics with Python - e.g. using Forgejo / Gitea Actions. Visualizations can include data for private repositories.

You can choose between light and dark mode.

Codeberg · repo.or.cz (mirror) · NotABug.org (mirror)

Background

When someone views a profile, 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.

This project aims to collect a variety of profile and repository statistics using the Forgejo / Gitea API. It then generates images that can be displayed in repository READMEs, or in a user's Profile README.

There are many GitHub statistics visualizations for GitHub. But also at Forgejo or Gitea some are interested in the number of stars of a user, the most used programming languages or the changed lines.

This project is still under development, but it's a good start. It is already possible to create simple visualizations.

This project uses GitHub stats by Jacob Strieb (licensed under GPL 3.0 or later) as base and uses the Language Colors by OZH (licensed under WTFPL) for the language color visualizations.

Since the project runs on Forgejo / Gitea Actions, no server is required to regularly regenerate the images with updated statistics. Likewise, since the user runs the analysis code themselves via Forgejo / Gitea Actions, they can use their access token to collect statistics on private repositories that an external service would be unable to access.

Installation

Using the CI

Using Woodpecker CI

  1. Create a personal access token using the instructions here. Personal access token must have permissions: Read - repository and Read - user. Copy the access token when it is generated – if you lose it, you will have to regenerate the token.
  2. Create a second personal access token with the permission Read & write - repository
  3. Create a copy of this repository: Use this template by clinking this link. Choose Git content (Defalt branch). This will create a new copy of this repo. Note: this is not the same as forking a copy because it copies everything fresh without the huge commit history.
  4. If you use Codeberg, you'll have to request an account for Woodpecker CI here.
  5. Go to the CI page and select the repository. Go to settings (the gear on the top right corner) and select Secrets.
  6. Add the following secrets:
    • git_url - e.g. https://codeberg.org
    • user - e.g. Tuxilio
    • access_token - Your access token generated in step 1
    • commit_token - Your access token generated in step 2 The tokens need the events Cron and if you want to run it manual Manual
  7. Go to the repository page inside the CI and press "Run pipeline" on the top right corner to generate images for the first time.
    • We'll set up a cron job so the images will be automatically regenerated every 24 hours, but they can be regenerated manually by running the workflow this way.
  8. Take a look at the images that have been created in the generated folder. If all looks right, you're nearly done!
  9. Set up a cron job: e.g @daily to run the workflow each day at midnight.
  10. To add your statistics to your Profile README, copy and paste the following lines of code into your markdown content. Change the username value to your Forgejo / Gitea username. md <div align="center"> <a href="https://codeberg.org/username/forgejo-stats"> <img src="https://codeberg.org/username/forgejo-stats/media/branch/main/generated/overview.svg"/> <img src="https://codeberg.org/username/forgejo-stats/media/branch/main/generated/languages.svg"/> </a> </div>
  11. Star this repo if you like it!

You're done! 🎉

If something has gone wrong, check everything again carefully. If it still doesn't work, please open an issue.

Running yourself

First, install requests:

 pip install requirements.txt

Now you can run the main program:

 python3 main.py

Support the Project

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

  • Star the repository (and follow me on Codeberg for more)
  • Report any bugs, glitches, or errors that you find

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

Related Projects