You've already forked wakapi-readme-stats
15
.env.example
Normal file
15
.env.example
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
INPUT_WAKATIME_API_KEY=a-f5a6a1f04d31
|
||||||
|
INPUT_GH_TOKEN=4204a
|
||||||
|
INPUT_SHOW_TIMEZONE=y
|
||||||
|
INPUT_SHOW_PROJECTS=y
|
||||||
|
INPUT_SHOW_EDITORS=y
|
||||||
|
INPUT_SHOW_OS=y
|
||||||
|
INPUT_SHOW_COMMIT=y
|
||||||
|
INPUT_SHOW_LANGUAGE=y
|
||||||
|
INPUT_SHOW_LANGUAGE_PER_REPO=y
|
||||||
|
INPUT_SHOW_LOC_CHART=n
|
||||||
|
INPUT_SHOW_LINES_OF_CODE=y
|
||||||
|
INPUT_SHOW_DAYS_OF_WEEK=y
|
||||||
|
INPUT_SHOW_PROFILE_VIEWS=y
|
||||||
|
INPUT_SHOW_SHORT_INFO=y
|
||||||
|
INPUT_LOCALE=fr
|
||||||
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: BUG
|
||||||
|
labels: bug
|
||||||
|
assignees: anmol098
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Github repository link**
|
||||||
|
If applicable, please share the Github repository link.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: FEAT
|
||||||
|
labels: Brainstorming
|
||||||
|
assignees: anmol098
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
15
.github/ISSUE_TEMPLATE/special-mention.md
vendored
Normal file
15
.github/ISSUE_TEMPLATE/special-mention.md
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
name: Special mention
|
||||||
|
about: Add your name to the list if you are making your profile readme more awesome
|
||||||
|
with our GitHub Action
|
||||||
|
title: Add||<your github username here>
|
||||||
|
labels: Name
|
||||||
|
assignees: anmol098
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Github Profile Link**
|
||||||
|
A direct link to your profile
|
||||||
|
|
||||||
|
**Your Name**
|
||||||
|
your name which should be displayed on the link
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
||||||
|
.vscode
|
||||||
|
|||||||
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at anmolpratapsingh1997@gmail.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
||||||
56
CONTRIBUTING.md
Normal file
56
CONTRIBUTING.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
|
||||||
|
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Thanks for taking the time to look at `CONTRIBUTING.md`.
|
||||||
|
|
||||||
|
All contributions to this project should follow the `CODE_OF_CONDUCT.md`.
|
||||||
|
|
||||||
|
### Reporting issues and providing feedback
|
||||||
|
|
||||||
|
If you found any issues or bugs, be sure to open up an issue so I can check it out!
|
||||||
|
|
||||||
|
|
||||||
|
### Opening a pull request
|
||||||
|
|
||||||
|
Once you've worked on your feature/bugfix etc, you can open a pull request using the `Alpha` branch as the base branch. Write a clear and concise PR title, and a detailed description of why you made the change, whether it is related to any issues etc. And I will review it as soon as I can.
|
||||||
|
**If the code is not linted properly or not reformatted the PR will be rejected**
|
||||||
|
|
||||||
|
### Setting up development environment
|
||||||
|
|
||||||
|
This project is written in Python, requires **Python 3.6 or higher**, and uses `pip` .
|
||||||
|
|
||||||
|
To set it up, just fork + clone it, install all the dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
The command will install all the requirements needed to run project.
|
||||||
|
|
||||||
|
create a `.env` file in the project directory for information you can refer to the `.env.example` file for all the environment variable
|
||||||
|
|
||||||
|
If you want to contribute the chart module then you have enable that flag in `.env` file and install nodeJs and NPM for charting library to work
|
||||||
|
```bash
|
||||||
|
npm install -g vega-lite vega-cli canvas
|
||||||
|
```
|
||||||
|
|
||||||
|
If everything is installed, you are good to go 👍.
|
||||||
|
```bash
|
||||||
|
python main.py
|
||||||
|
```
|
||||||
|
to run the program
|
||||||
|
|
||||||
|
**Linting checks**
|
||||||
|
|
||||||
|
It is recommended to use proper linting. if you using Jetbrains IntelliJ IDE please reformat code before making pull request
|
||||||
|
for more info [How to reformat code in Intellij](https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html)
|
||||||
|
|
||||||
|
|
||||||
|
**Commit Messages**
|
||||||
|
|
||||||
|
It is recommended to use proper sementic commit messages. [Sementic commit message](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@ ADD main.py /main.py
|
|||||||
ADD loc.py /loc.py
|
ADD loc.py /loc.py
|
||||||
ADD make_bar_graph.py /make_bar_graph.py
|
ADD make_bar_graph.py /make_bar_graph.py
|
||||||
ADD colors.json /colors.json
|
ADD colors.json /colors.json
|
||||||
|
ADD translation.json /translation.json
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
|
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
|
||||||
|
|||||||
172
README.md
172
README.md
@@ -1,3 +1,5 @@
|
|||||||
|
> Looking For Translation to different languages & Locale [#23](https://github.com/anmol098/waka-readme-stats/issues/23)
|
||||||
|
|
||||||
# Dev Metrics in Readme with added feature flags 🎌
|
# Dev Metrics in Readme with added feature flags 🎌
|
||||||
|
|
||||||

|

|
||||||
@@ -39,13 +41,13 @@
|
|||||||
1. You need to update the markdown file(.md) with 2 comments. You can refer [here](#update-your-readme) for updating it.
|
1. You need to update the markdown file(.md) with 2 comments. You can refer [here](#update-your-readme) for updating it.
|
||||||
2. You'll need a WakaTime API Key. You can get that from your WakaTime Account Settings
|
2. You'll need a WakaTime API Key. You can get that from your WakaTime Account Settings
|
||||||
- You can refer [here](#new-to-wakatime), if you're new to WakaTime
|
- You can refer [here](#new-to-wakatime), if you're new to WakaTime
|
||||||
3. You'll need a GitHub API Token with `repo` scope from [here](https://github.com/settings/tokens) if you're running the action to get commit metrics
|
3. You'll need a GitHub API Token with `repo` and `user` scope from [here](https://github.com/settings/tokens) if you're running the action to get commit metrics
|
||||||
> enable `repo` scope seems **DANGEROUS**<br/>
|
> enabling the `repo` scope seems **DANGEROUS**<br/>
|
||||||
> but this GitHub Action only accesses your commit timestamp in repository you contributed.
|
> but this GitHub Action only accesses your commit timestamp and lines of code added or deleted in repository you contributed.
|
||||||
- You can use [this](#profile-repository) example to work it out
|
- You can use [this](#profile-repository) example to work it out
|
||||||
4. You need to save the WakaTime API Key and the GitHub API Token in the repository secrets. You can find that in the Settings of your Repository.Be sure to save those as the following.
|
4. You need to save the WakaTime API Key and the GitHub API Token in the repository secrets. You can find that in the Settings of your repository. Be sure to save those as the following.
|
||||||
- WakaTime-api-key as `WAKATIME_API_KEY = <your wakatime API Key>`and
|
- WakaTime API Key as `WAKATIME_API_KEY=<your wakatime API Key>`
|
||||||
- The GitHub Access Token as `GH_TOKEN=<your github access token>`
|
- GitHub Personal Access Token as `GH_TOKEN=<your github access token>`
|
||||||
5. You can enable and disable feature flags based on requirements.
|
5. You can enable and disable feature flags based on requirements.
|
||||||
|
|
||||||
|
|
||||||
@@ -73,7 +75,7 @@ WakaTime gives you an idea of the time you really spent on coding. This helps yo
|
|||||||
|
|
||||||
### Profile Repository
|
### Profile Repository
|
||||||
|
|
||||||
You'll need to get a [GitHub Access Token](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) with a `repo` scope and save it in the Repo Secrets `GH_TOKEN = <Your GitHub Access Token>`
|
You'll need to get a [GitHub Access Token](https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) with a `repo` and `user` scope and save it in the Repo Secrets `GH_TOKEN = <Your GitHub Access Token>`
|
||||||
|
|
||||||
Here is Sample Workflow File for running it:
|
Here is Sample Workflow File for running it:
|
||||||
|
|
||||||
@@ -109,10 +111,20 @@ jobs:
|
|||||||
SHOW_PROJECTS: "False"
|
SHOW_PROJECTS: "False"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Flags Available
|
### Flags Available
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
`LOCALE` This Flag can be used to show stats in your language default is english uses Locale [Short Hand](https://saimana.com/list-of-country-locale-code/) to be passed in the flag variable example of the final result can be found [here](https://github.com/anmol098/anmol098/blob/master/Readme-fr.md)
|
||||||
|
|
||||||
|
|
||||||
`SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date
|
`SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
`SHOW_PROFILE_VIEWS` flag can be set to `False` to hide the Profile views
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
`SHOW_COMMIT` flag can be set to `False` to hide the commit stats
|
`SHOW_COMMIT` flag can be set to `False` to hide the commit stats
|
||||||
@@ -125,6 +137,9 @@ jobs:
|
|||||||
🌙 Night 26 commits ██░░░░░░░░░░░░░░░░░░░░░░░ 8.36%
|
🌙 Night 26 commits ██░░░░░░░░░░░░░░░░░░░░░░░ 8.36%
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`SHOW_DAYS_OF_WEEK` flag can be set to `False` to hide the commits made on different days of week
|
||||||
|
|
||||||
📅 **I'm Most Productive on Sundays**
|
📅 **I'm Most Productive on Sundays**
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@@ -183,6 +198,42 @@ PhpStorm 1 hr 35 mins ████░░░░░░░
|
|||||||
PyCharm 23 mins █░░░░░░░░░░░░░░░░░░░░░░░░ 4.49%
|
PyCharm 23 mins █░░░░░░░░░░░░░░░░░░░░░░░░ 4.49%
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`SHOW_LANGUAGE_PER_REPO` flag can be set to `False` to hide the Number of repository in different language and frameworks
|
||||||
|
|
||||||
|
**I mostly code in Vue**
|
||||||
|
|
||||||
|
```text
|
||||||
|
Vue 8 repos ██████░░░░░░░░░░░░░░░░░░░ 25.0%
|
||||||
|
Java 6 repos ████░░░░░░░░░░░░░░░░░░░░░ 18.75%
|
||||||
|
JavaScript 6 repos ████░░░░░░░░░░░░░░░░░░░░░ 18.75%
|
||||||
|
PHP 3 repos ██░░░░░░░░░░░░░░░░░░░░░░░ 9.38%
|
||||||
|
Python 2 repos █░░░░░░░░░░░░░░░░░░░░░░░░ 6.25%
|
||||||
|
Dart 2 repos █░░░░░░░░░░░░░░░░░░░░░░░░ 6.25%
|
||||||
|
CSS 2 repos █░░░░░░░░░░░░░░░░░░░░░░░░ 6.25%
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
`SHOW_SHORT_INFO` flag can be set to `False` to hide the short fun fact info of user
|
||||||
|
>This section requires personal access token with user permission otherwise data shown will be incorrect here
|
||||||
|
|
||||||
|
**🐱 My GitHub Data**
|
||||||
|
|
||||||
|
> 🏆 433 Contributions in year 2020
|
||||||
|
>
|
||||||
|
> 📦 Used 292.3 kB in GitHub's Storage
|
||||||
|
>
|
||||||
|
> 💼 Opted to Hire
|
||||||
|
>
|
||||||
|
> 📜 25 Public Repository
|
||||||
|
>
|
||||||
|
> 🔑 15 Owned Private Repository
|
||||||
|
|
||||||
|
`SHOW_LOC_CHART` flag can be set to `False` to hide the Lines of code written in different quarters of different year
|
||||||
|
|
||||||
|
**Timeline**
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## :sparkling_heart: Support the project
|
## :sparkling_heart: Support the project
|
||||||
|
|
||||||
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,
|
||||||
@@ -198,13 +249,106 @@ Thanks! :heart:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Contributions are welcomed! ♥
|
# Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! ♥! Please share any features, and add unit tests! Use the pull request and issue systems to contribute.
|
||||||
|
|
||||||
|
# Selected Contributors
|
||||||
|
|
||||||
|
1. [Anmol Pratap Singh](https://github.com/anmol098): Maintainer
|
||||||
|
2. [Prabhat Singh](https://github.com/prabhatdev): For code timeline graph [#18](https://github.com/anmol098/waka-readme-stats/pull/18)
|
||||||
|
3. [Hedy Li](https://github.com/hedythedev): For Pull Request [#34](https://github.com/anmol098/waka-readme-stats/pull/34) and [#23](https://github.com/anmol098/waka-readme-stats/pull/23)
|
||||||
|
4. [Pedro Torres](https://github.com/Corfucinas): For Pull Request [#29](https://github.com/anmol098/waka-readme-stats/pull/29)
|
||||||
|
5. [Aaron Meese](https://github.com/ajmeese7): For Pull Request [#45](https://github.com/anmol098/waka-readme-stats/pull/45)
|
||||||
|
6. [Arnav Jindal](https://github.com/Daggy1234): For Pull Request [#48](https://github.com/anmol098/waka-readme-stats/pull/48)
|
||||||
|
7. [Daniel Rowe](https://github.com/DanRowe1): For Pull Request [#57](https://github.com/anmol098/waka-readme-stats/pull/57)
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Special mention for those who are currently making their profile readme more awesome :smile: :tada:</summary>
|
||||||
|
|
||||||
|
- [Stanislas](https://github.com/angristan)
|
||||||
|
|
||||||
|
- [Pratik Kumar](https://github.com/pr2tik1)
|
||||||
|
|
||||||
|
- [Vladimir](https://github.com/sergeev-vn)
|
||||||
|
|
||||||
|
- [Pedro Torres](https://github.com/Corfucinas)
|
||||||
|
|
||||||
|
- [leverglowh](https://github.com/leverglowh)
|
||||||
|
|
||||||
|
- [patdc](https://github.com/patdc)
|
||||||
|
|
||||||
|
- [极客挖掘机](https://github.com/meteor1993)
|
||||||
|
|
||||||
|
- [Fan()](https://github.com/Fanduzi)
|
||||||
|
|
||||||
|
- [Miller Camilo Vega](https://github.com/minoveaz)
|
||||||
|
|
||||||
|
- [XLor](https://github.com/yjl9903)
|
||||||
|
|
||||||
|
- [Jesse Okeya](https://github.com/jesseokeya)
|
||||||
|
|
||||||
|
- [anaiel](https://github.com/anaiel)
|
||||||
|
|
||||||
|
- [Dipto Mondal](https://github.com/diptomondal007)
|
||||||
|
|
||||||
|
- [Jerry F. Zhang](https://github.com/JerryFZhang)
|
||||||
|
|
||||||
|
- [Karan Singh](https://github.com/karan06126)
|
||||||
|
|
||||||
|
- [Erwin Lejeune](https://github.com/guilyx)
|
||||||
|
|
||||||
|
- [Manuel Cepeda](https://github.com/mecm1993)
|
||||||
|
|
||||||
|
- [Jonathan S](https://github.com/TGTGamer)
|
||||||
|
|
||||||
|
- [Tsotne Gvadzabia](https://github.com/RockiRider)
|
||||||
|
|
||||||
|
- [Miray](https://github.com/MirayXS)
|
||||||
|
|
||||||
|
- [Varad Patil](https://github.com/varadp2000)
|
||||||
|
|
||||||
|
- [Prabhat Singh](https://github.com/prabhatdev)
|
||||||
|
|
||||||
|
- [Nikhil](https://github.com/nikhilgorantla)
|
||||||
|
|
||||||
|
- [大白](https://github.com/2720851545)
|
||||||
|
|
||||||
|
- [Du Yizhuo](https://github.com/dyzdyz010)
|
||||||
|
|
||||||
|
- [Manas Talukdar](https://github.com/manastalukdar)
|
||||||
|
|
||||||
|
- [Simranjeet Singh](https://github.com/smrnjeet222)
|
||||||
|
|
||||||
|
- [Aaron Meese](https://github.com/ajmeese7)
|
||||||
|
|
||||||
|
- [Prasad Narkhede](https://github.com/p014ri5)
|
||||||
|
|
||||||
|
- [Manish Kushwaha](https://github.com/tzmanish)
|
||||||
|
|
||||||
|
- [Hedy Li](https://github.com/hedythedev)
|
||||||
|
|
||||||
|
- [SHIMIZU Taku](https://github.com/takuan-osho)
|
||||||
|
|
||||||
|
- [Jude Wilson](https://github.com/mr-winson)
|
||||||
|
|
||||||
|
- [Daniel Rowe](https://github.com/DanRowe1)
|
||||||
|
|
||||||
|
- [Muhammad Hassan Ahmed](https://github.com/hassan11196)
|
||||||
|
|
||||||
|
- [Alessandro Maggio](https://github.com/Tkd-Alex)
|
||||||
|
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
- And you! If ever you are using it right now and you are not on the list please tell us by sending a [Special Mention](https://github.com/anmol098/waka-readme-stats/issues/new/choose) issue :blush: we are glad to add you in the list.
|
||||||
|
|
||||||
|
|
||||||
Made with :heart: and Python 🐍.
|
Made with :heart: and Python 🐍.
|
||||||
|
|
||||||
|
# Inspired From
|
||||||
|
|
||||||
|
> [Awesome Pinned Gists](https://github.com/matchai/awesome-pinned-gists) <br/>
|
||||||
|
> [athul/waka-readme](https://github.com/athul/waka-readme)
|
||||||
|
|
||||||
> This project is inspired by an awesome pinned-gist project [Awesome Pinned Gists](https://github.com/matchai/awesome-pinned-gists) <br/>
|
### This project need a **star** ⭐ from you ♥.
|
||||||
>This project is inspired from [athul/waka-readme](https://github.com/athul/waka-readme)
|
|
||||||
|
|
||||||
### Don't forget to leave a ⭐ if you found this useful.
|
|
||||||
|
|||||||
26
action.yml
26
action.yml
@@ -12,11 +12,6 @@ inputs:
|
|||||||
description: 'Your Wakatime API Key'
|
description: 'Your Wakatime API Key'
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
USERNAME:
|
|
||||||
description: 'Your GitHub username'
|
|
||||||
required: false
|
|
||||||
default: ${{ github.repository_owner }}
|
|
||||||
|
|
||||||
SHOW_OS:
|
SHOW_OS:
|
||||||
required: false
|
required: false
|
||||||
description: 'Show the list of OS Worked on In dev metrics'
|
description: 'Show the list of OS Worked on In dev metrics'
|
||||||
@@ -54,7 +49,7 @@ inputs:
|
|||||||
|
|
||||||
SHOW_LANGUAGE_PER_REPO:
|
SHOW_LANGUAGE_PER_REPO:
|
||||||
required: false
|
required: false
|
||||||
description: ""
|
description: "Show language or framework used across different repository"
|
||||||
default: "True"
|
default: "True"
|
||||||
|
|
||||||
SHOW_LOC_CHART:
|
SHOW_LOC_CHART:
|
||||||
@@ -62,6 +57,25 @@ inputs:
|
|||||||
description: ""
|
description: ""
|
||||||
default: "True"
|
default: "True"
|
||||||
|
|
||||||
|
SHOW_DAYS_OF_WEEK:
|
||||||
|
required: false
|
||||||
|
description: "show day of week you are most productive"
|
||||||
|
default: "True"
|
||||||
|
|
||||||
|
SHOW_PROFILE_VIEWS:
|
||||||
|
required: false
|
||||||
|
description: "Shows the current profile views"
|
||||||
|
default: "True"
|
||||||
|
|
||||||
|
SHOW_SHORT_INFO:
|
||||||
|
required: false
|
||||||
|
description: "Shows the short facts"
|
||||||
|
default: "True"
|
||||||
|
|
||||||
|
LOCALE:
|
||||||
|
required: false
|
||||||
|
description: "Show stats in your own language"
|
||||||
|
default: "en"
|
||||||
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
|
|||||||
19
loc.py
19
loc.py
@@ -2,7 +2,7 @@ import re
|
|||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
import requests
|
import requests
|
||||||
from github import Github
|
from github import Github, InputGitAuthor
|
||||||
import datetime
|
import datetime
|
||||||
from string import Template
|
from string import Template
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@@ -27,12 +27,8 @@ class LinesOfCode:
|
|||||||
result = self.repositoryData
|
result = self.repositoryData
|
||||||
yearly_data = {}
|
yearly_data = {}
|
||||||
for repo in result['data']['user']['repositories']['edges']:
|
for repo in result['data']['user']['repositories']['edges']:
|
||||||
print(repo)
|
|
||||||
self.getCommitStat(repo['node'], yearly_data)
|
self.getCommitStat(repo['node'], yearly_data)
|
||||||
time.sleep(0.7)
|
time.sleep(0.7)
|
||||||
# print("\n\n")
|
|
||||||
# print(yearly_data)
|
|
||||||
# print("here")
|
|
||||||
graph = BarGraph(yearly_data)
|
graph = BarGraph(yearly_data)
|
||||||
graph_file = graph.build_graph()
|
graph_file = graph.build_graph()
|
||||||
self.pushChart()
|
self.pushChart()
|
||||||
@@ -43,7 +39,10 @@ class LinesOfCode:
|
|||||||
request = requests.get(endPoint, headers=self.headers)
|
request = requests.get(endPoint, headers=self.headers)
|
||||||
if request.status_code == 401:
|
if request.status_code == 401:
|
||||||
raise Exception("Invalid token {}. {}".format(request.status_code, nameWithOwner))
|
raise Exception("Invalid token {}. {}".format(request.status_code, nameWithOwner))
|
||||||
return request.json()
|
elif request.status_code == 204:
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
return request.json()
|
||||||
|
|
||||||
def getQuarter(self, timeStamp):
|
def getQuarter(self, timeStamp):
|
||||||
month = datetime.datetime.fromtimestamp(timeStamp).month
|
month = datetime.datetime.fromtimestamp(timeStamp).month
|
||||||
@@ -82,13 +81,11 @@ class LinesOfCode:
|
|||||||
|
|
||||||
def pushChart(self):
|
def pushChart(self):
|
||||||
repo = self.g.get_repo(f"{self.username}/{self.username}")
|
repo = self.g.get_repo(f"{self.username}/{self.username}")
|
||||||
|
committer = InputGitAuthor('readme-bot', 'readme-bot@example.com')
|
||||||
with open('bar_graph.png', 'rb') as input_file:
|
with open('bar_graph.png', 'rb') as input_file:
|
||||||
data = input_file.read()
|
data = input_file.read()
|
||||||
try:
|
try:
|
||||||
contents = repo.get_contents("charts/bar_graph.png")
|
contents = repo.get_contents("charts/bar_graph.png")
|
||||||
repo.update_file(contents.path, "Charts Added", data, contents.sha)
|
repo.update_file(contents.path, "Charts Updated", data, contents.sha, committer=committer)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
repo.create_file("charts/bar_graph.png", "Initial Commit", data)
|
repo.create_file("charts/bar_graph.png", "Charts Added", data, committer=committer)
|
||||||
# print("pushed")
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
326
main.py
326
main.py
@@ -1,19 +1,24 @@
|
|||||||
'''
|
'''
|
||||||
Readme Development Metrics With waka time progress
|
Readme Development Metrics With waka time progress
|
||||||
'''
|
'''
|
||||||
import locale
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
import sys
|
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
import pytz
|
import pytz
|
||||||
import requests
|
import requests
|
||||||
from github import Github, GithubException
|
from github import Github, GithubException, InputGitAuthor
|
||||||
import datetime
|
import datetime
|
||||||
from string import Template
|
from string import Template
|
||||||
from dotenv import load_dotenv
|
|
||||||
from loc import LinesOfCode
|
from loc import LinesOfCode
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
import humanize
|
||||||
|
from urllib.parse import quote
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
@@ -21,19 +26,21 @@ START_COMMENT = '<!--START_SECTION:waka-->'
|
|||||||
END_COMMENT = '<!--END_SECTION:waka-->'
|
END_COMMENT = '<!--END_SECTION:waka-->'
|
||||||
listReg = f"{START_COMMENT}[\\s\\S]+{END_COMMENT}"
|
listReg = f"{START_COMMENT}[\\s\\S]+{END_COMMENT}"
|
||||||
|
|
||||||
user = 'y' if os.getenv('INPUT_USERNAME') is None else os.getenv('INPUT_USERNAME')
|
waka_key = os.getenv('INPUT_WAKATIME_API_KEY')
|
||||||
waka_key = 'y' if os.getenv('INPUT_WAKATIME_API_KEY') is None else os.getenv('INPUT_WAKATIME_API_KEY')
|
ghtoken = os.getenv('INPUT_GH_TOKEN')
|
||||||
ghtoken = 'y' if os.getenv('INPUT_GH_TOKEN') is None else os.getenv('INPUT_GH_TOKEN')
|
showTimeZone = os.getenv('INPUT_SHOW_TIMEZONE')
|
||||||
showTimeZone = 'y' if os.getenv('INPUT_SHOW_TIMEZONE') is None else os.getenv('INPUT_SHOW_TIMEZONE')
|
showProjects = os.getenv('INPUT_SHOW_PROJECTS')
|
||||||
showProjects = 'y' if os.getenv('INPUT_SHOW_PROJECTS') is None else os.getenv('INPUT_SHOW_PROJECTS')
|
showEditors = os.getenv('INPUT_SHOW_EDITORS')
|
||||||
showEditors = 'y' if os.getenv('INPUT_SHOW_EDITORS') is None else os.getenv('INPUT_SHOW_EDITORS')
|
showOs = os.getenv('INPUT_SHOW_OS')
|
||||||
showOs = 'y' if os.getenv('INPUT_SHOW_OS') is None else os.getenv('INPUT_SHOW_OS')
|
showCommit = os.getenv('INPUT_SHOW_COMMIT')
|
||||||
showCommit = 'y' if os.getenv('INPUT_SHOW_COMMIT') is None else os.getenv('INPUT_SHOW_COMMIT')
|
showLanguage = os.getenv('INPUT_SHOW_LANGUAGE')
|
||||||
showLanguage = 'y' if os.getenv('INPUT_SHOW_LANGUAGE') is None else os.getenv('INPUT_SHOW_LANGUAGE')
|
show_loc = os.getenv('INPUT_SHOW_LINES_OF_CODE')
|
||||||
show_loc = 'y' if os.getenv('INPUT_SHOW_LINES_OF_CODE') is None else os.getenv('INPUT_SHOW_LINES_OF_CODE')
|
show_days_of_week = os.getenv('INPUT_SHOW_DAYS_OF_WEEK')
|
||||||
|
showLanguagePerRepo = os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO')
|
||||||
showLanguagePerRepo = 'y' if os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO') is None else os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO')
|
showLocChart = os.getenv('INPUT_SHOW_LOC_CHART')
|
||||||
showLocChart = 'y' if os.getenv('INPUT_SHOW_LOC_CHART') is None else os.getenv('INPUT_SHOW_LOC_CHART')
|
show_profile_view = os.getenv('INPUT_SHOW_PROFILE_VIEWS')
|
||||||
|
show_short_info = os.getenv('INPUT_SHOW_SHORT_INFO')
|
||||||
|
locale = os.getenv('INPUT_LOCALE')
|
||||||
show_waka_stats = 'y'
|
show_waka_stats = 'y'
|
||||||
# The GraphQL query to get commit data.
|
# The GraphQL query to get commit data.
|
||||||
userInfoQuery = """
|
userInfoQuery = """
|
||||||
@@ -79,6 +86,9 @@ query {
|
|||||||
""")
|
""")
|
||||||
|
|
||||||
get_loc_url = Template("""/repos/$owner/$repo/stats/code_frequency""")
|
get_loc_url = Template("""/repos/$owner/$repo/stats/code_frequency""")
|
||||||
|
get_profile_view = Template("""/repos/$owner/$repo/traffic/views?per=week""")
|
||||||
|
get_profile_traffic = Template("""/repos/$owner/$repo/traffic/popular/referrers""")
|
||||||
|
truthy = ['true', '1', 't', 'y', 'yes']
|
||||||
|
|
||||||
|
|
||||||
def run_v3_api(query):
|
def run_v3_api(query):
|
||||||
@@ -87,7 +97,8 @@ def run_v3_api(query):
|
|||||||
return request.json()
|
return request.json()
|
||||||
else:
|
else:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"Query failed to run by returning code of {}. {},... {}".format(request.status_code, query, request.json()))
|
"Query failed to run by returning code of {}. {},... {}".format(request.status_code, query,
|
||||||
|
str(request.json())))
|
||||||
|
|
||||||
|
|
||||||
repositoryListQuery = Template("""
|
repositoryListQuery = Template("""
|
||||||
@@ -195,17 +206,7 @@ def generate_commit_list(tz):
|
|||||||
Saturday = 0
|
Saturday = 0
|
||||||
Sunday = 0
|
Sunday = 0
|
||||||
|
|
||||||
total_loc = 0
|
|
||||||
|
|
||||||
for repository in repos:
|
for repository in repos:
|
||||||
if show_loc.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
try:
|
|
||||||
datas = run_v3_api(get_loc_url.substitute(owner=repository["owner"]["login"], repo=repository["name"]))
|
|
||||||
for data in datas:
|
|
||||||
total_loc = total_loc + data[1] - data[2]
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
result = run_query(
|
result = run_query(
|
||||||
createCommittedDateQuery.substitute(owner=repository["owner"]["login"], name=repository["name"], id=id))
|
createCommittedDateQuery.substitute(owner=repository["owner"]["login"], name=repository["name"], id=id))
|
||||||
try:
|
try:
|
||||||
@@ -244,91 +245,106 @@ def generate_commit_list(tz):
|
|||||||
|
|
||||||
sumAll = morning + daytime + evening + night
|
sumAll = morning + daytime + evening + night
|
||||||
sum_week = Sunday + Monday + Tuesday + Friday + Saturday + Wednesday + Thursday
|
sum_week = Sunday + Monday + Tuesday + Friday + Saturday + Wednesday + Thursday
|
||||||
if morning + daytime >= evening + night:
|
title = translate['I am an Early'] if morning + daytime >= evening + night else translate['I am a Night']
|
||||||
title = "I'm an early 🐤"
|
|
||||||
else:
|
|
||||||
title = "I'm a night 🦉"
|
|
||||||
one_day = [
|
one_day = [
|
||||||
{"name": "🌞 Morning", "text": str(morning) + " commits", "percent": round((morning / sumAll) * 100, 2)},
|
{"name": "🌞 " + translate['Morning'], "text": str(morning) + " commits",
|
||||||
{"name": "🌆 Daytime", "text": str(daytime) + " commits", "percent": round((daytime / sumAll) * 100, 2)},
|
"percent": round((morning / sumAll) * 100, 2)},
|
||||||
{"name": "🌃 Evening", "text": str(evening) + " commits", "percent": round((evening / sumAll) * 100, 2)},
|
{"name": "🌆 " + translate['Daytime'], "text": str(daytime) + " commits",
|
||||||
{"name": "🌙 Night", "text": str(night) + " commits", "percent": round((night / sumAll) * 100, 2)},
|
"percent": round((daytime / sumAll) * 100, 2)},
|
||||||
|
{"name": "🌃 " + translate['Evening'], "text": str(evening) + " commits",
|
||||||
|
"percent": round((evening / sumAll) * 100, 2)},
|
||||||
|
{"name": "🌙 " + translate['Night'], "text": str(night) + " commits",
|
||||||
|
"percent": round((night / sumAll) * 100, 2)},
|
||||||
]
|
]
|
||||||
dayOfWeek = [
|
dayOfWeek = [
|
||||||
{"name": "Monday", "text": str(Monday) + " commits", "percent": round((Monday / sum_week) * 100, 2)},
|
{"name": translate['Monday'], "text": str(Monday) + " commits", "percent": round((Monday / sum_week) * 100, 2)},
|
||||||
{"name": "Tuesday", "text": str(Tuesday) + " commits", "percent": round((Tuesday / sum_week) * 100, 2)},
|
{"name": translate['Tuesday'], "text": str(Tuesday) + " commits",
|
||||||
{"name": "Wednesday", "text": str(Wednesday) + " commits", "percent": round((Wednesday / sum_week) * 100, 2)},
|
"percent": round((Tuesday / sum_week) * 100, 2)},
|
||||||
{"name": "Thursday", "text": str(Thursday) + " commits", "percent": round((Thursday / sum_week) * 100, 2)},
|
{"name": translate['Wednesday'], "text": str(Wednesday) + " commits",
|
||||||
{"name": "Friday", "text": str(Friday) + " commits", "percent": round((Friday / sum_week) * 100, 2)},
|
"percent": round((Wednesday / sum_week) * 100, 2)},
|
||||||
{"name": "Saturday", "text": str(Saturday) + " commits", "percent": round((Saturday / sum_week) * 100, 2)},
|
{"name": translate['Thursday'], "text": str(Thursday) + " commits",
|
||||||
{"name": "Sunday", "text": str(Sunday) + " commits", "percent": round((Sunday / sum_week) * 100, 2)},
|
"percent": round((Thursday / sum_week) * 100, 2)},
|
||||||
|
{"name": translate['Friday'], "text": str(Friday) + " commits", "percent": round((Friday / sum_week) * 100, 2)},
|
||||||
|
{"name": translate['Saturday'], "text": str(Saturday) + " commits",
|
||||||
|
"percent": round((Saturday / sum_week) * 100, 2)},
|
||||||
|
{"name": translate['Sunday'], "text": str(Sunday) + " commits", "percent": round((Sunday / sum_week) * 100, 2)},
|
||||||
]
|
]
|
||||||
|
|
||||||
max_element = {
|
|
||||||
'percent': 0
|
|
||||||
}
|
|
||||||
|
|
||||||
for day in dayOfWeek:
|
|
||||||
if day['percent'] > max_element['percent']:
|
|
||||||
max_element = day
|
|
||||||
days_title = 'I\'m Most Productive on ' + max_element['name'] + 's'
|
|
||||||
if show_loc.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
string = string + ' + '%20Lines%20of%20code-blue)\n\n'
|
|
||||||
string = string + '**' + title + '** \n\n' + '```text\n' + make_commit_list(one_day) + '\n\n```\n'
|
string = string + '**' + title + '** \n\n' + '```text\n' + make_commit_list(one_day) + '\n\n```\n'
|
||||||
string = string + '📅 **' + days_title + '** \n\n' + '```text\n' + make_commit_list(dayOfWeek) + '\n\n```\n'
|
|
||||||
return string
|
|
||||||
|
|
||||||
|
if show_days_of_week.lower() in truthy:
|
||||||
|
max_element = {
|
||||||
|
'percent': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
for day in dayOfWeek:
|
||||||
|
if day['percent'] > max_element['percent']:
|
||||||
|
max_element = day
|
||||||
|
days_title = translate['I am Most Productive on'] + ' ' + max_element['name']
|
||||||
|
string = string + '📅 **' + days_title + '** \n\n' + '```text\n' + make_commit_list(dayOfWeek) + '\n\n```\n'
|
||||||
|
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
def get_waka_time_stats():
|
def get_waka_time_stats():
|
||||||
stats = ''
|
stats = ''
|
||||||
request = requests.get(
|
request = requests.get(
|
||||||
f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}")
|
f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}")
|
||||||
|
no_activity = translate["No Activity Tracked This Week"]
|
||||||
|
|
||||||
if request.status_code != 401:
|
if request.status_code == 401:
|
||||||
data = request.json()
|
|
||||||
if showCommit.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n'
|
|
||||||
stats = stats + '📊 **This week I spent my time on** \n\n'
|
|
||||||
stats = stats + '```text\n'
|
|
||||||
if showTimeZone.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
timezone = data['data']['timezone']
|
|
||||||
stats = stats + '⌚︎ Timezone: ' + timezone + '\n\n'
|
|
||||||
|
|
||||||
if showLanguage.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
if len(data['data']['languages']) != 0:
|
|
||||||
lang_list = make_list(data['data']['languages'])
|
|
||||||
else:
|
|
||||||
lang_list = "No Activity tracked this Week"
|
|
||||||
stats = stats + '💬 Languages: \n' + lang_list + '\n\n'
|
|
||||||
|
|
||||||
if showEditors.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
if len(data['data']['editors']) != 0:
|
|
||||||
edit_list = make_list(data['data']['editors'])
|
|
||||||
else:
|
|
||||||
edit_list = "No Activity tracked this Week"
|
|
||||||
stats = stats + '🔥 Editors: \n' + edit_list + '\n\n'
|
|
||||||
|
|
||||||
if showProjects.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
if len(data['data']['projects']) != 0:
|
|
||||||
project_list = make_list(data['data']['projects'])
|
|
||||||
else:
|
|
||||||
project_list = "No Activity tracked this Week"
|
|
||||||
stats = stats + '🐱💻 Projects: \n' + project_list + '\n\n'
|
|
||||||
|
|
||||||
if showOs.lower() in ['true', '1', 't', 'y', 'yes']:
|
|
||||||
if len(data['data']['operating_systems']) != 0:
|
|
||||||
os_list = make_list(data['data']['operating_systems'])
|
|
||||||
else:
|
|
||||||
os_list = "No Activity tracked this Week"
|
|
||||||
stats = stats + '💻 Operating Systems: \n' + os_list + '\n\n'
|
|
||||||
|
|
||||||
stats = stats + '```\n\n'
|
|
||||||
else:
|
|
||||||
print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json()))
|
print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json()))
|
||||||
|
else:
|
||||||
|
empty = True
|
||||||
|
data = request.json()
|
||||||
|
if showCommit.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n'
|
||||||
|
|
||||||
|
stats += '📊 **' + translate['This Week I Spend My Time On'] + '** \n\n'
|
||||||
|
stats += '```text\n'
|
||||||
|
if showTimeZone.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
tzone = data['data']['timezone']
|
||||||
|
stats = stats + '⌚︎ ' + translate['Timezone'] + ': ' + tzone + '\n\n'
|
||||||
|
|
||||||
|
if showLanguage.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
if len(data['data']['languages']) == 0:
|
||||||
|
lang_list = no_activity
|
||||||
|
else:
|
||||||
|
lang_list = make_list(data['data']['languages'])
|
||||||
|
stats = stats + '💬 ' + translate['Languages'] + ': \n' + lang_list + '\n\n'
|
||||||
|
|
||||||
|
if showEditors.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
if len(data['data']['editors']) == 0:
|
||||||
|
edit_list = no_activity
|
||||||
|
else:
|
||||||
|
edit_list = make_list(data['data']['editors'])
|
||||||
|
stats = stats + '🔥 ' + translate['Editors'] + ': \n' + edit_list + '\n\n'
|
||||||
|
|
||||||
|
if showProjects.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
if len(data['data']['projects']) == 0:
|
||||||
|
project_list = no_activity
|
||||||
|
else:
|
||||||
|
# Re-order the project list by percentage
|
||||||
|
data['data']['projects'] = sorted(data['data']['projects'], key=lambda x: x["percent"], reverse=True)
|
||||||
|
project_list = make_list(data['data']['projects'])
|
||||||
|
stats = stats + '🐱💻 ' + translate['Projects'] + ': \n' + project_list + '\n\n'
|
||||||
|
|
||||||
|
if showOs.lower() in truthy:
|
||||||
|
empty = False
|
||||||
|
if len(data['data']['operating_systems']) == 0:
|
||||||
|
os_list = no_activity
|
||||||
|
else:
|
||||||
|
os_list = make_list(data['data']['operating_systems'])
|
||||||
|
stats = stats + '💻 ' + translate['operating system'] + ': \n' + os_list + '\n\n'
|
||||||
|
|
||||||
|
stats += '```\n\n'
|
||||||
|
if empty:
|
||||||
|
return ""
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
@@ -344,11 +360,9 @@ def generate_language_per_repo(result):
|
|||||||
if language not in language_count.keys():
|
if language not in language_count.keys():
|
||||||
language_count[language] = {}
|
language_count[language] = {}
|
||||||
language_count[language]['count'] = 1
|
language_count[language]['count'] = 1
|
||||||
language_count[language]['color'] = color_code
|
|
||||||
else:
|
else:
|
||||||
language_count[language]['count'] = language_count[language]['count'] + 1
|
language_count[language]['count'] = language_count[language]['count'] + 1
|
||||||
language_count[language]['color'] = color_code
|
language_count[language]['color'] = color_code
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
sorted_labels = list(language_count.keys())
|
sorted_labels = list(language_count.keys())
|
||||||
sorted_labels.sort(key=lambda x: language_count[x]['count'], reverse=True)
|
sorted_labels.sort(key=lambda x: language_count[x]['count'], reverse=True)
|
||||||
@@ -361,37 +375,103 @@ def generate_language_per_repo(result):
|
|||||||
"percent": percent
|
"percent": percent
|
||||||
})
|
})
|
||||||
|
|
||||||
title = 'I mostly code in ' + most_language_repo
|
title = translate['I Mostly Code in'] + ' ' + most_language_repo
|
||||||
return '**' + title + '** \n\n' + '```text\n' + make_commit_list(data) + '\n\n```\n'
|
return '**' + title + '** \n\n' + '```text\n' + make_list(data) + '\n\n```\n'
|
||||||
|
|
||||||
|
|
||||||
def get_stats():
|
def get_line_of_code():
|
||||||
|
result = run_query(createContributedRepoQuery.substitute(username=username))
|
||||||
|
nodes = result["data"]["user"]["repositoriesContributedTo"]["nodes"]
|
||||||
|
repos = [d for d in nodes if d['isFork'] is False]
|
||||||
|
total_loc = 0
|
||||||
|
for repository in repos:
|
||||||
|
try:
|
||||||
|
time.sleep(0.7)
|
||||||
|
datas = run_v3_api(get_loc_url.substitute(owner=repository["owner"]["login"], repo=repository["name"]))
|
||||||
|
for data in datas:
|
||||||
|
total_loc = total_loc + data[1] - data[2]
|
||||||
|
except Exception as execp:
|
||||||
|
print(execp)
|
||||||
|
return humanize.intword(int(total_loc))
|
||||||
|
|
||||||
|
|
||||||
|
def get_short_info(github):
|
||||||
|
string = '**🐱 ' + translate['My GitHub Data'] + '** \n\n'
|
||||||
|
user_info = github.get_user()
|
||||||
|
if user_info.disk_usage is None:
|
||||||
|
disk_usage = humanize.naturalsize(0)
|
||||||
|
print("Please add new github personal access token with user permission")
|
||||||
|
else:
|
||||||
|
disk_usage = humanize.naturalsize(user_info.disk_usage)
|
||||||
|
request = requests.get('https://github-contributions.now.sh/api/v1/' + user_info.login)
|
||||||
|
if request.status_code == 200:
|
||||||
|
data = request.json()
|
||||||
|
total = data['years'][0]['total']
|
||||||
|
year = data['years'][0]['year']
|
||||||
|
string += '> 🏆 ' + humanize.intcomma(total) + " " + translate[
|
||||||
|
'Contributions in the year'] + " " + year + '\n > \n'
|
||||||
|
|
||||||
|
string += '> 📦 ' + disk_usage + " " + translate["Used in GitHub's Storage"] + ' \n > \n'
|
||||||
|
is_hireable = user_info.hireable
|
||||||
|
public_repo = user_info.public_repos
|
||||||
|
private_repo = user_info.owned_private_repos
|
||||||
|
if private_repo is None:
|
||||||
|
private_repo = 0
|
||||||
|
if is_hireable:
|
||||||
|
string += "> 💼 " + translate["Opted to Hire"] + "\n > \n"
|
||||||
|
else:
|
||||||
|
string += "> 🚫 " + translate["Not Opted to Hire"] + "\n > \n"
|
||||||
|
|
||||||
|
string += '> 📜 ' + str(public_repo) + " "
|
||||||
|
string += translate['public repositories'] + '\n > \n' if public_repo > 1 else translate[
|
||||||
|
'public repository'] + ' \n > \n'
|
||||||
|
string += '> 🔑 ' + str(private_repo) + " "
|
||||||
|
string += translate['private repositories'] + ' \n\n' if private_repo > 1 else translate[
|
||||||
|
'private repository'] + ' \n > \n'
|
||||||
|
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
|
def get_stats(github):
|
||||||
'''Gets API data and returns markdown progress'''
|
'''Gets API data and returns markdown progress'''
|
||||||
|
|
||||||
stats = ''
|
stats = ''
|
||||||
repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id))
|
repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id))
|
||||||
|
|
||||||
|
if show_profile_view.lower() in truthy:
|
||||||
|
data = run_v3_api(get_profile_view.substitute(owner=username, repo=username))
|
||||||
|
stats += ') + '-' + str(
|
||||||
|
data['count']) + '-blue)\n\n'
|
||||||
|
|
||||||
if show_waka_stats.lower() in ['true', '1', 't', 'y', 'yes']:
|
if show_loc.lower() in truthy:
|
||||||
stats = stats + get_waka_time_stats()
|
stats += ') + '-' + quote(
|
||||||
|
str(get_line_of_code())) + '%20' + quote(str(translate['Lines of code'])) + '-blue)\n\n'
|
||||||
|
|
||||||
|
if show_short_info.lower() in truthy:
|
||||||
|
stats += get_short_info(github)
|
||||||
|
|
||||||
if showLanguagePerRepo.lower() in ['true', '1', 't', 'y', 'yes']:
|
if show_waka_stats.lower() in truthy:
|
||||||
|
stats += get_waka_time_stats()
|
||||||
|
|
||||||
|
if showLanguagePerRepo.lower() in truthy:
|
||||||
stats = stats + generate_language_per_repo(repositoryList) + '\n\n'
|
stats = stats + generate_language_per_repo(repositoryList) + '\n\n'
|
||||||
|
|
||||||
if showLocChart.lower() in ['true', '1', 't', 'y', 'yes']:
|
if showLocChart.lower() in truthy:
|
||||||
loc = LinesOfCode(id, username, ghtoken, repositoryList)
|
loc = LinesOfCode(id, username, ghtoken, repositoryList)
|
||||||
loc.calculateLoc()
|
loc.calculateLoc()
|
||||||
stats = stats + '**Timeline**\n\n'
|
stats += '**' + translate['Timeline'] + '**\n\n'
|
||||||
stats = stats + ' \n\n'
|
stats = stats + ' \n\n'
|
||||||
# stats = stats + generate_language_per_repo(repositoryList) + '\n\n'
|
|
||||||
|
|
||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
|
def star_me():
|
||||||
|
request = requests.put("https://api.github.com/user/starred/anmol098/waka-readme-stats", headers=headers)
|
||||||
|
|
||||||
|
|
||||||
def decode_readme(data: str):
|
def decode_readme(data: str):
|
||||||
'''Decode the contets of old readme'''
|
'''Decode the contents of old readme'''
|
||||||
decoded_bytes = base64.b64decode(data)
|
decoded_bytes = base64.b64decode(data)
|
||||||
return str(decoded_bytes, 'utf-8')
|
return str(decoded_bytes, 'utf-8')
|
||||||
|
|
||||||
@@ -411,16 +491,26 @@ if __name__ == '__main__':
|
|||||||
user_data = run_query(userInfoQuery) # Execute the query
|
user_data = run_query(userInfoQuery) # Execute the query
|
||||||
username = user_data["data"]["viewer"]["login"]
|
username = user_data["data"]["viewer"]["login"]
|
||||||
id = user_data["data"]["viewer"]["id"]
|
id = user_data["data"]["viewer"]["id"]
|
||||||
# print("user {} id {}".format(username, id))
|
print(username)
|
||||||
repo = g.get_repo(f"{username}/{username}")
|
repo = g.get_repo(f"{username}/{username}")
|
||||||
contents = repo.get_readme()
|
contents = repo.get_readme()
|
||||||
waka_stats = get_stats()
|
try:
|
||||||
|
with open(os.path.join(os.path.dirname(__file__), 'translation.json'), encoding='utf-8') as config_file:
|
||||||
|
data = json.load(config_file)
|
||||||
|
translate = data[locale]
|
||||||
|
except Exception as e:
|
||||||
|
print("Cannot find the Locale choosing default to english")
|
||||||
|
translate = data['en']
|
||||||
|
waka_stats = get_stats(g)
|
||||||
|
star_me()
|
||||||
rdmd = decode_readme(contents.content)
|
rdmd = decode_readme(contents.content)
|
||||||
new_readme = generate_new_readme(stats=waka_stats, readme=rdmd)
|
new_readme = generate_new_readme(stats=waka_stats, readme=rdmd)
|
||||||
# print(new_readme)
|
committer = InputGitAuthor('readme-bot', 'readme-bot@example.com')
|
||||||
if new_readme != rdmd:
|
if new_readme != rdmd:
|
||||||
repo.update_file(path=contents.path, message='Updated with Dev Metrics',
|
repo.update_file(path=contents.path, message='Updated with Dev Metrics',
|
||||||
content=new_readme, sha=contents.sha, branch='master')
|
content=new_readme, sha=contents.sha, branch='master',
|
||||||
print("Readme updated")
|
committer=committer)
|
||||||
|
print("Readme updated")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Exception Occurred" + str(e))
|
traceback.print_exc()
|
||||||
|
print("Exception Occurred " + str(e))
|
||||||
|
|||||||
@@ -60,3 +60,4 @@ virtualenv-clone==0.5.4
|
|||||||
wrapt==1.12.1
|
wrapt==1.12.1
|
||||||
xlrd==1.2.0
|
xlrd==1.2.0
|
||||||
XlsxWriter==1.2.8
|
XlsxWriter==1.2.8
|
||||||
|
humanize==2.5.0
|
||||||
|
|||||||
150
translation.json
Normal file
150
translation.json
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
{
|
||||||
|
"fr": {
|
||||||
|
"Monday": "Lundi",
|
||||||
|
"Tuesday": "Mardi",
|
||||||
|
"Wednesday": "Mercredi",
|
||||||
|
"Thursday": "Jeudi",
|
||||||
|
"Friday": "Vendredi",
|
||||||
|
"Saturday": "Samedi",
|
||||||
|
"Sunday": "Dimanche",
|
||||||
|
"Morning": "Matin",
|
||||||
|
"Daytime": "Journée",
|
||||||
|
"Evening": "Soirée",
|
||||||
|
"Night": "Nuit",
|
||||||
|
"Languages": "Langages",
|
||||||
|
"Editors": "Éditeurs de code",
|
||||||
|
"operating system": "Système d'exploitation",
|
||||||
|
"Projects": "Projets",
|
||||||
|
"Timezone": "Fuseau horaire",
|
||||||
|
"Contributions in the year": "Contributions en",
|
||||||
|
"Used in GitHub's Storage": "Utilisés avec le stockage de GitHub",
|
||||||
|
"Opted to Hire": "A choisi d'embaucher",
|
||||||
|
"Not Opted to Hire": "N'a pas choisi d'embaucher",
|
||||||
|
"Profile Views": "Vues du profil",
|
||||||
|
"From Hello World I have written": "Depuis Hello World, j'ai écrit",
|
||||||
|
"I am Most Productive on": "Je suis le plus productif sur",
|
||||||
|
"This Week I Spend My Time On": "Cette semaine, je passe mon temps sur",
|
||||||
|
"I Mostly Code in": "Je code principalement en",
|
||||||
|
"Timeline": "Chronologie",
|
||||||
|
"No Activity Tracked This Week": "Aucune activité enregistrée cette semaine",
|
||||||
|
"My GitHub Data": "Mes données GitHub",
|
||||||
|
"Lines of code": "Lignes de code",
|
||||||
|
"public repository": "dépot publique",
|
||||||
|
"public repositories": "dépots publiques",
|
||||||
|
"private repository": "dépot privé",
|
||||||
|
"private repositories": "dépots privés",
|
||||||
|
"I am an Early": "Je suis un 🐤 du matin",
|
||||||
|
"I am a Night": "Je suis un 🦉 de nuit"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"Monday": "Monday",
|
||||||
|
"Tuesday": "Tuesday",
|
||||||
|
"Wednesday": "Wednesday",
|
||||||
|
"Thursday": "Thursday",
|
||||||
|
"Friday": "Friday",
|
||||||
|
"Saturday": "Saturday",
|
||||||
|
"Sunday": "Sunday",
|
||||||
|
"Morning": "Morning",
|
||||||
|
"Daytime": "Daytime",
|
||||||
|
"Evening": "Evening",
|
||||||
|
"Night": "Night",
|
||||||
|
"Languages": "Programming Languages",
|
||||||
|
"Editors": "Code Editors",
|
||||||
|
"operating system": "Operating System",
|
||||||
|
"Projects": "Projects",
|
||||||
|
"Timezone": "Time zone",
|
||||||
|
"Contributions in the year": "Contributions in the year",
|
||||||
|
"Used in GitHub's Storage": "Used in Github's Storage",
|
||||||
|
"Opted to Hire": "Opted to Hire",
|
||||||
|
"Not Opted to Hire": "Not Opted to Hire",
|
||||||
|
"Profile Views": "Profile Views",
|
||||||
|
"From Hello World I have written": "From Hello World I've Written",
|
||||||
|
"I am Most Productive on": "I'm Most Productive on",
|
||||||
|
"This Week I Spend My Time On": "This Week I Spend My Time On",
|
||||||
|
"I Mostly Code in": "I Mostly Code in",
|
||||||
|
"Timeline": "Timeline",
|
||||||
|
"No Activity Tracked This Week": "No Activity Tracked This Week",
|
||||||
|
"My GitHub Data": "My Github Data",
|
||||||
|
"Lines of code": "Lines of code",
|
||||||
|
"public repository": "Public repository",
|
||||||
|
"public repositories": "Public repositories",
|
||||||
|
"private repository": "Private repository",
|
||||||
|
"private repositories": "Private repositories",
|
||||||
|
"I am an Early": "I'm an Early 🐤",
|
||||||
|
"I am a Night": "I'm a Night 🦉"
|
||||||
|
},
|
||||||
|
"it": {
|
||||||
|
"Monday": "Lunedì",
|
||||||
|
"Tuesday": "Martedì",
|
||||||
|
"Wednesday": "Mecoledì",
|
||||||
|
"Thursday": "Giovedì",
|
||||||
|
"Friday": "Venerdì",
|
||||||
|
"Saturday": "Sabato",
|
||||||
|
"Sunday": "Domenica",
|
||||||
|
"Morning": "Mattina",
|
||||||
|
"Daytime": "Giorno",
|
||||||
|
"Evening": "Pomeriggio",
|
||||||
|
"Night": "Notte",
|
||||||
|
"Languages": "Linguaggi di programmazione",
|
||||||
|
"Editors": "Editor di testo",
|
||||||
|
"operating system": "Sistema operativo",
|
||||||
|
"Projects": "Progetti",
|
||||||
|
"Timezone": "Fuso orario",
|
||||||
|
"Contributions in the year": "Contributi nell'ultimo anno",
|
||||||
|
"Used in GitHub's Storage": "Spazio di archiviazione di Github utilizzato",
|
||||||
|
"Opted to Hire": "Pronto per essere assunto",
|
||||||
|
"Not Opted to Hire": "Non disponibile per assunzioni/colloqui",
|
||||||
|
"Profile Views": "Visite al profilo",
|
||||||
|
"From Hello World I have written": "Dal mio primo Hello World ho scritto ",
|
||||||
|
"I am Most Productive on": "Sono piu' produttivo di",
|
||||||
|
"This Week I Spend My Time On": "Questa settimana ho speso il mio tempo su",
|
||||||
|
"I Mostly Code in": "Solitamente programmo in",
|
||||||
|
"Timeline": "Linea temporale",
|
||||||
|
"No Activity Tracked This Week": "Nessuna attività tracciata questa settimana",
|
||||||
|
"My GitHub Data": "I miei dati GitHub",
|
||||||
|
"Lines of code": "Linee di codice",
|
||||||
|
"public repository": "Repository pubblica",
|
||||||
|
"public repositories": "Repositories pubbliche",
|
||||||
|
"private repository": "Repository privata",
|
||||||
|
"private repositories": "Repositories private",
|
||||||
|
"I am an Early": "Sono un mattiniero 🐤",
|
||||||
|
"I am a Night": "Sono un notturno 🦉"
|
||||||
|
},
|
||||||
|
"zh": {
|
||||||
|
"Monday": "星期一",
|
||||||
|
"Tuesday": "星期二",
|
||||||
|
"Wednesday": "星期三",
|
||||||
|
"Thursday": "星期四",
|
||||||
|
"Friday": "星期五",
|
||||||
|
"Saturday": "星期六",
|
||||||
|
"Sunday": "星期天",
|
||||||
|
"Morning": "早晨",
|
||||||
|
"Daytime": "白天",
|
||||||
|
"Evening": "傍晚",
|
||||||
|
"Night": "晚上",
|
||||||
|
"Languages": "编程语言",
|
||||||
|
"Editors": "编辑器",
|
||||||
|
"operating system": "操作系统",
|
||||||
|
"Projects": "项目",
|
||||||
|
"Timezone": "时区",
|
||||||
|
"Contributions in the year": "今年的贡献",
|
||||||
|
"Used in GitHub's Storage": "占用了 GitHub 内存",
|
||||||
|
"Opted to Hire": "选择雇用",
|
||||||
|
"Not Opted to Hire": "不选择雇用",
|
||||||
|
"Profile Views": "个人封面观看次数",
|
||||||
|
"From Hello World I have written": "从你好世界我已经写了",
|
||||||
|
"I am Most Productive on": "我最有效率是",
|
||||||
|
"This Week I Spend My Time On": "这周我花我的时间在",
|
||||||
|
"I Mostly Code in": "我主要编程在于",
|
||||||
|
"Timeline": "时间线",
|
||||||
|
"No Activity Tracked This Week": "本周没有记录任何活动",
|
||||||
|
"My GitHub Data": "我的 GitHub 数据",
|
||||||
|
"Lines of code": "行代码",
|
||||||
|
"public repository": "公共仓库",
|
||||||
|
"public repositories": "公共仓库",
|
||||||
|
"private repository": "私人仓库",
|
||||||
|
"private repositories": "私人仓库",
|
||||||
|
"I am an Early": "我是早起的 🐤",
|
||||||
|
"I am a Night": "我是晚起的 🦉"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user