From b0e95e8d62e7fb5d16f77745715ae14c7d48ee5e Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Mon, 27 Jul 2020 02:14:34 +0530 Subject: [PATCH 01/63] Update main.py --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 30d8d44..ac6f924 100644 --- a/main.py +++ b/main.py @@ -81,7 +81,7 @@ def run_v3_api(query): return request.json() else: 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()))) def run_query(query): From da161a8e965ffb5625ddf522d63488aa115e7f63 Mon Sep 17 00:00:00 2001 From: Anmol Date: Thu, 30 Jul 2020 21:01:14 +0530 Subject: [PATCH 02/63] FIX: ADDED HUMAN READABLE LINES OF CODE --- main.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ac6f924..5482064 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,7 @@ import requests from github import Github import datetime from string import Template +import time START_COMMENT = '' END_COMMENT = '' @@ -75,13 +76,24 @@ query { get_loc_url = Template("""/repos/$owner/$repo/stats/code_frequency""") +def human_format(num): + magnitude = 0 + while abs(num) >= 1000: + magnitude += 1 + num /= 1000.0 + # add more suffixes if you need them + return '%.2f%s' % (num, ['', 'K', 'M', 'G', 'T', 'P'][magnitude]) + + def run_v3_api(query): request = requests.get('https://api.github.com' + query, headers=headers) if request.status_code == 200: return request.json() else: + print(request.json()) raise Exception( - "Query failed to run by returning code of {}. {},... {}".format(request.status_code, query, str(request.json()))) + "Query failed to run by returning code of {}. {},... {}".format(request.status_code, query, + str(request.json()))) def run_query(query): @@ -151,6 +163,7 @@ def generate_commit_list(tz): for repository in repos: if show_loc.lower() in ['true', '1', 't', 'y', 'yes']: 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] @@ -224,9 +237,8 @@ def generate_commit_list(tz): 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 + '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + locale.format_string( - "%d", total_loc, - grouping=True) + '%20Lines%20of%20code-blue)\n\n' + string = string + '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + human_format( + int(total_loc)) + '%20Lines%20of%20code-blue)\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' From 8cd96583a6791209dca20e0a9e5f76b2985a59d2 Mon Sep 17 00:00:00 2001 From: Anmol Date: Fri, 31 Jul 2020 18:52:05 +0530 Subject: [PATCH 03/63] FEAT: ADDED NEW MODULES --- geckodriver.log | 0 loc.py | 7 ------- main.py | 22 +++++++--------------- 3 files changed, 7 insertions(+), 22 deletions(-) delete mode 100644 geckodriver.log diff --git a/geckodriver.log b/geckodriver.log deleted file mode 100644 index e69de29..0000000 diff --git a/loc.py b/loc.py index d9bf064..dec73dc 100644 --- a/loc.py +++ b/loc.py @@ -27,12 +27,8 @@ class LinesOfCode: result = self.repositoryData yearly_data = {} for repo in result['data']['user']['repositories']['edges']: - print(repo) self.getCommitStat(repo['node'], yearly_data) time.sleep(0.7) - # print("\n\n") - # print(yearly_data) - # print("here") graph = BarGraph(yearly_data) graph_file = graph.build_graph() self.pushChart() @@ -89,6 +85,3 @@ class LinesOfCode: repo.update_file(contents.path, "Charts Added", data, contents.sha) except Exception as e: repo.create_file("charts/bar_graph.png", "Initial Commit", data) - # print("pushed") - - diff --git a/main.py b/main.py index 800c953..2b72637 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,9 @@ ''' Readme Development Metrics With waka time progress ''' -import locale import re import os import base64 -import sys from pytz import timezone import pytz import requests @@ -28,8 +26,8 @@ showCommit = os.getenv('INPUT_SHOW_COMMIT') showLanguage = os.getenv('INPUT_SHOW_LANGUAGE') show_loc = os.getenv('INPUT_SHOW_LINES_OF_CODE') -showLanguagePerRepo = 'y' if os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO') is None else os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO') -showLocChart = 'y' if os.getenv('INPUT_SHOW_LOC_CHART') is None else os.getenv('INPUT_SHOW_LOC_CHART') +showLanguagePerRepo = os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO') +showLocChart = os.getenv('INPUT_SHOW_LOC_CHART') show_waka_stats = 'y' # The GraphQL query to get commit data. userInfoQuery = """ @@ -288,7 +286,6 @@ def generate_commit_list(tz): return string - def get_waka_time_stats(): stats = '' request = requests.get( @@ -301,8 +298,8 @@ def get_waka_time_stats(): 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' + tzone = data['data']['timezone'] + stats = stats + '⌚︎ Timezone: ' + tzone + '\n\n' if showLanguage.lower() in ['true', '1', 't', 'y', 'yes']: if len(data['data']['languages']) != 0: @@ -378,11 +375,9 @@ def get_stats(): stats = '' repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id)) - if show_waka_stats.lower() in ['true', '1', 't', 'y', 'yes']: stats = stats + get_waka_time_stats() - if showLanguagePerRepo.lower() in ['true', '1', 't', 'y', 'yes']: stats = stats + generate_language_per_repo(repositoryList) + '\n\n' @@ -390,9 +385,7 @@ def get_stats(): loc = LinesOfCode(id, username, ghtoken, repositoryList) loc.calculateLoc() stats = stats + '**Timeline**\n\n' - stats = stats + '![Chart not found](https://github.com/prabhatdev/prabhatdev/blob/master/charts/bar_graph.png) \n\n' - # stats = stats + generate_language_per_repo(repositoryList) + '\n\n' - + stats = stats + '![Chart not found](https://github.com/' + username + '/' + username + '/blob/master/charts/bar_graph.png) \n\n' return stats @@ -418,7 +411,6 @@ if __name__ == '__main__': user_data = run_query(userInfoQuery) # Execute the query username = user_data["data"]["viewer"]["login"] id = user_data["data"]["viewer"]["id"] - # print("user {} id {}".format(username, id)) repo = g.get_repo(f"{username}/{username}") contents = repo.get_readme() waka_stats = get_stats() @@ -428,6 +420,6 @@ if __name__ == '__main__': if new_readme != rdmd: repo.update_file(path=contents.path, message='Updated with Dev Metrics', content=new_readme, sha=contents.sha, branch='master') - print("Readme updated") + print("Readme updated") except Exception as e: - print("Exception Occurred" + str(e)) + print("Exception Occurred " + str(e)) From 478835b8d88968c4df63003ec6faaf7bbafb3380 Mon Sep 17 00:00:00 2001 From: Anmol Date: Fri, 31 Jul 2020 19:00:21 +0530 Subject: [PATCH 04/63] HOTFIX: SMASHED BUGS DURING MERGE --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 2b72637..d2f8b9d 100644 --- a/main.py +++ b/main.py @@ -10,6 +10,8 @@ import requests from github import Github, GithubException import datetime from string import Template +from loc import LinesOfCode +import time START_COMMENT = '' END_COMMENT = '' From e16857d6ad2309d8a49426083b44094c2bfcee59 Mon Sep 17 00:00:00 2001 From: Anmol Date: Fri, 31 Jul 2020 20:21:01 +0530 Subject: [PATCH 05/63] HOTFIX: SMASHED BUGS DURING MERGE --- README.md | 23 ++++++++++++++++++++++- action.yml | 12 ++++++------ main.py | 23 ++++++++++++----------- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d03ec33..b1b3877 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ jobs: #### Flags Available `SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date -![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-12,66,814%20Lines%20of%20code-blue) +![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-1.28M%20Lines%20of%20code-blue) `SHOW_COMMIT` flag can be set to `False` to hide the commit stats @@ -183,6 +183,27 @@ PhpStorm 1 hr 35 mins ████░░░░░░░ 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_LOC_CHART` flag can be set to `False` to hide the Lines of code written in different quarters of different year + +**Timeline** + +![Chart not found](https://raw.githubusercontent.com/anmol098/anmol098/master/charts/bar_graph.png) + ## :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, diff --git a/action.yml b/action.yml index 0a91b88..32292c7 100644 --- a/action.yml +++ b/action.yml @@ -12,11 +12,6 @@ inputs: description: 'Your Wakatime API Key' required: true - USERNAME: - description: 'Your GitHub username' - required: false - default: ${{ github.repository_owner }} - SHOW_OS: required: false description: 'Show the list of OS Worked on In dev metrics' @@ -54,7 +49,7 @@ inputs: SHOW_LANGUAGE_PER_REPO: required: false - description: "" + description: "Show language or framework used across different repository" default: "True" SHOW_LOC_CHART: @@ -62,6 +57,11 @@ inputs: description: "" default: "True" + SHOW_DAYS_OF_WEEK: + required: false + description: "show day of week you are most productive" + default: "True" + runs: diff --git a/main.py b/main.py index d2f8b9d..e4d2243 100644 --- a/main.py +++ b/main.py @@ -17,7 +17,6 @@ START_COMMENT = '' END_COMMENT = '' listReg = f"{START_COMMENT}[\\s\\S]+{END_COMMENT}" -user = os.getenv('INPUT_USERNAME') waka_key = os.getenv('INPUT_WAKATIME_API_KEY') ghtoken = os.getenv('INPUT_GH_TOKEN') showTimeZone = os.getenv('INPUT_SHOW_TIMEZONE') @@ -27,7 +26,7 @@ showOs = os.getenv('INPUT_SHOW_OS') showCommit = os.getenv('INPUT_SHOW_COMMIT') showLanguage = os.getenv('INPUT_SHOW_LANGUAGE') show_loc = 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') showLocChart = os.getenv('INPUT_SHOW_LOC_CHART') show_waka_stats = 'y' @@ -271,19 +270,21 @@ def generate_commit_list(tz): {"name": "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 + '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + human_format( int(total_loc)) + '%20Lines%20of%20code-blue)\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' + + if show_days_of_week.lower() in ['true', '1', 't', 'y', 'yes']: + 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' + string = string + '📅 **' + days_title + '** \n\n' + '```text\n' + make_commit_list(dayOfWeek) + '\n\n```\n' return string From a16266253e52b7009d6e24be1b77df6ae2d19802 Mon Sep 17 00:00:00 2001 From: Anmol Date: Fri, 31 Jul 2020 20:32:57 +0530 Subject: [PATCH 06/63] FIX: Fixes #21 --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b1b3877..21eee44 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,9 @@ jobs: 🌙 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** ```text From 388e635180c90689958cacd5c842319d9692f49e Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Fri, 31 Jul 2020 21:37:58 +0530 Subject: [PATCH 07/63] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7914a09 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -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 From 5d7448185234f243a6828c36ab3b3132974d33c6 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Fri, 31 Jul 2020 22:05:07 +0530 Subject: [PATCH 08/63] Create CONTRIBUTING.md --- CONTRIBUTING.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b40f792 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,51 @@ +# 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) + From 0a8bd49be9070be5af759cd120136c8602b6bd1b Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Fri, 31 Jul 2020 22:09:37 +0530 Subject: [PATCH 09/63] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 27 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..3f27a96 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..6f1750e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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. From f893c3450266d9679dad9c652acb68441da012a2 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Fri, 31 Jul 2020 22:14:07 +0530 Subject: [PATCH 10/63] Update CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b40f792..31b3d11 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,3 +49,8 @@ to run the program 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) + From 35686abe11d05e3c9ddaf138d6ef00ecff4ac7c3 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 1 Aug 2020 14:07:04 +0530 Subject: [PATCH 11/63] ADDED: .env example file --- .env.example | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3ac7f76 --- /dev/null +++ b/.env.example @@ -0,0 +1,12 @@ +INPUT_WAKATIME_API_KEY=7d31 +INPUT_GH_TOKEN=4208134c4a +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=n \ No newline at end of file From 675ed35d4e7635a6f7009c65db1c5854f8002e53 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sat, 1 Aug 2020 18:09:15 +0530 Subject: [PATCH 12/63] Update issue templates --- .github/ISSUE_TEMPLATE/special-mention.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/special-mention.md diff --git a/.github/ISSUE_TEMPLATE/special-mention.md b/.github/ISSUE_TEMPLATE/special-mention.md new file mode 100644 index 0000000..5afc52a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/special-mention.md @@ -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|| +labels: Name +assignees: anmol098 + +--- + +**Github Profile Link** +A direct link to your profile + +**Your Name** +your name which should be displayed on the link From bb75a2a9bb94da69e272e03d39d53f71bfb72305 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 1 Aug 2020 18:16:49 +0530 Subject: [PATCH 13/63] ADDED: USER MENTION TO THE README --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 21eee44..03ebee3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +>Looking For Translation to different languages #23 + # Dev Metrics in Readme with added feature flags 🎌 ![Project Preview](https://user-images.githubusercontent.com/25841814/79395484-5081ae80-7fac-11ea-9e27-ac91472e31dd.png) @@ -222,13 +224,73 @@ 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 + +- [Anmol Pratap Singh](https://github.com/anmol098): maintainer +- [Prabhat Singh](https://github.com/prabhatdev): For code timeline graph + +
+

Special mention for those who are currently making their profile readme more awesome :smile: :tada:

+ + - [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) + + +
+ +- 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 issue [Special Mention](https://github.com/anmol098/waka-readme-stats/issues/new/choose) :blush: we are glad to add you in the list. + Made with :heart: and Python 🐍. +# Inspired From +> [Awesome Pinned Gists](https://github.com/matchai/awesome-pinned-gists)
+> [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)
->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. +### This project need a **star** ⭐ from you ♥. From 8b5549bcd1ffbefca54cd24a9d0ae399526c6373 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sat, 1 Aug 2020 18:18:37 +0530 Subject: [PATCH 14/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03ebee3..5d29f82 100644 --- a/README.md +++ b/README.md @@ -234,7 +234,7 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Prabhat Singh](https://github.com/prabhatdev): For code timeline graph
-

Special mention for those who are currently making their profile readme more awesome :smile: :tada:

+Special mention for those who are currently making their profile readme more awesome :smile: :tada: - [Stanislas](https://github.com/angristan) From 6da88f6cfa35506433ae2edb78402c207e134d57 Mon Sep 17 00:00:00 2001 From: Pedro Torres <53630064+Corfucinas@users.noreply.github.com> Date: Sun, 2 Aug 2020 14:05:51 +0800 Subject: [PATCH 15/63] Update for a more pythonistic syntax Updated functions get_waka_time_stats() generate_language_per_repo() get_stats() Hoist repeated code outside conditional statement --- main.py | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/main.py b/main.py index e4d2243..a7655b6 100644 --- a/main.py +++ b/main.py @@ -294,48 +294,48 @@ def get_waka_time_stats(): request = requests.get( f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}") - if request.status_code != 401: + if request.status_code == 401: + print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json())) + + else: 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' + stats += '📊 **This week I spent my time on** \n\n' + stats += '```text\n' if showTimeZone.lower() in ['true', '1', 't', 'y', 'yes']: tzone = data['data']['timezone'] stats = stats + '⌚︎ Timezone: ' + tzone + '\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: + if len(data['data']['languages']) == 0: lang_list = "No Activity tracked this Week" + else: + lang_list = make_list(data['data']['languages']) 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: + if len(data['data']['editors']) == 0: edit_list = "No Activity tracked this Week" + else: + edit_list = make_list(data['data']['editors']) 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: + if len(data['data']['projects']) == 0: project_list = "No Activity tracked this Week" + else: + project_list = make_list(data['data']['projects']) 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: + if len(data['data']['operating_systems']) == 0: os_list = "No Activity tracked this Week" + else: + os_list = make_list(data['data']['operating_systems']) 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())) - + stats += '```\n\n' return stats @@ -351,11 +351,9 @@ def generate_language_per_repo(result): if language not in language_count.keys(): language_count[language] = {} language_count[language]['count'] = 1 - language_count[language]['color'] = color_code else: language_count[language]['count'] = language_count[language]['count'] + 1 - language_count[language]['color'] = color_code - + language_count[language]['color'] = color_code data = [] sorted_labels = list(language_count.keys()) sorted_labels.sort(key=lambda x: language_count[x]['count'], reverse=True) @@ -379,7 +377,7 @@ def get_stats(): repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id)) if show_waka_stats.lower() in ['true', '1', 't', 'y', 'yes']: - stats = stats + get_waka_time_stats() + stats += get_waka_time_stats() if showLanguagePerRepo.lower() in ['true', '1', 't', 'y', 'yes']: stats = stats + generate_language_per_repo(repositoryList) + '\n\n' @@ -387,7 +385,7 @@ def get_stats(): if showLocChart.lower() in ['true', '1', 't', 'y', 'yes']: loc = LinesOfCode(id, username, ghtoken, repositoryList) loc.calculateLoc() - stats = stats + '**Timeline**\n\n' + stats += '**Timeline**\n\n' stats = stats + '![Chart not found](https://github.com/' + username + '/' + username + '/blob/master/charts/bar_graph.png) \n\n' return stats From 3f334bdf10680d7ef34c410b3d0af6e2e85d429b Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 11:52:23 +0530 Subject: [PATCH 16/63] ADDED: ERROR TRACEBACK --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index a7655b6..2baa288 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,7 @@ import datetime from string import Template from loc import LinesOfCode import time +import traceback START_COMMENT = '' END_COMMENT = '' @@ -412,15 +413,16 @@ if __name__ == '__main__': user_data = run_query(userInfoQuery) # Execute the query username = user_data["data"]["viewer"]["login"] id = user_data["data"]["viewer"]["id"] + print(username) repo = g.get_repo(f"{username}/{username}") contents = repo.get_readme() waka_stats = get_stats() rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) - # print(new_readme) if new_readme != rdmd: repo.update_file(path=contents.path, message='Updated with Dev Metrics', content=new_readme, sha=contents.sha, branch='master') print("Readme updated") except Exception as e: + traceback.print_exc() print("Exception Occurred " + str(e)) From 6461370353adf9f5bb9c3e909c04fa518f1ff166 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 15:50:21 +0530 Subject: [PATCH 17/63] FIX: Fixes #27 --- loc.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/loc.py b/loc.py index dec73dc..e46151c 100644 --- a/loc.py +++ b/loc.py @@ -39,7 +39,10 @@ class LinesOfCode: request = requests.get(endPoint, headers=self.headers) if request.status_code == 401: 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): month = datetime.datetime.fromtimestamp(timeStamp).month From f4e5c678fb5f4048b7c48539ddc36741401519f2 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 20:27:02 +0530 Subject: [PATCH 18/63] FEAT: ADDED PROFILE VIEW BADGE AND USER INFO --- action.yml | 10 +++++++ main.py | 88 ++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 82 insertions(+), 16 deletions(-) diff --git a/action.yml b/action.yml index 32292c7..184eedc 100644 --- a/action.yml +++ b/action.yml @@ -62,6 +62,16 @@ inputs: 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" + runs: diff --git a/main.py b/main.py index 2baa288..b874798 100644 --- a/main.py +++ b/main.py @@ -13,6 +13,12 @@ from string import Template from loc import LinesOfCode import time import traceback +import humanize +from urllib.parse import quote + +from dotenv import load_dotenv + +load_dotenv() START_COMMENT = '' END_COMMENT = '' @@ -30,6 +36,8 @@ show_loc = 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') showLocChart = os.getenv('INPUT_SHOW_LOC_CHART') +show_profile_view = os.getenv('INPUT_SHOW_PROFILE_VIEWS') +show_short_info = os.getenv('INPUT_SHOW_SHORT_INFO') show_waka_stats = 'y' # The GraphQL query to get commit data. userInfoQuery = """ @@ -75,6 +83,8 @@ query { """) get_loc_url = Template("""/repos/$owner/$repo/stats/code_frequency""") +get_profile_view = Template("""/repos/$owner/$repo/traffic/views""") +get_profile_traffic = Template("""/repos/$owner/$repo/traffic/popular/referrers""") def human_format(num): @@ -201,18 +211,7 @@ def generate_commit_list(tz): Saturday = 0 Sunday = 0 - total_loc = 0 - for repository in repos: - if show_loc.lower() in ['true', '1', 't', 'y', 'yes']: - 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 e: - print(e) - result = run_query( createCommittedDateQuery.substitute(owner=repository["owner"]["login"], name=repository["name"], id=id)) try: @@ -271,9 +270,6 @@ def generate_commit_list(tz): {"name": "Sunday", "text": str(Sunday) + " commits", "percent": round((Sunday / sum_week) * 100, 2)}, ] - if show_loc.lower() in ['true', '1', 't', 'y', 'yes']: - string = string + '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + human_format( - int(total_loc)) + '%20Lines%20of%20code-blue)\n\n' string = string + '**' + title + '** \n\n' + '```text\n' + make_commit_list(one_day) + '\n\n```\n' if show_days_of_week.lower() in ['true', '1', 't', 'y', 'yes']: @@ -302,6 +298,7 @@ def get_waka_time_stats(): data = request.json() if showCommit.lower() in ['true', '1', 't', 'y', 'yes']: stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' + stats += '📊 **This week I spent my time on** \n\n' stats += '```text\n' if showTimeZone.lower() in ['true', '1', 't', 'y', 'yes']: @@ -371,12 +368,71 @@ def generate_language_per_repo(result): return '**' + title + '** \n\n' + '```text\n' + make_commit_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 = '' + string += '**🐱 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) + ' Contributions in year ' + year + '\n > \n' + + string += '> 📦 Used ' + disk_usage + ' 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 is_hireable: + string += "> 💼 Opted to Hire\n > \n" + else: + string += "> 🚫 Not opted to Hire\n > \n" + + string += '> 📜 ' + str(public_repo) + ' Public Repository \n > \n' + string += '> 🔑 ' + str(private_repo) + ' Owned Private Repository \n\n' + + print(string) + return string + + +def get_stats(github): '''Gets API data and returns markdown progress''' stats = '' repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id)) + if show_profile_view.lower() in ['true', '1', 't', 'y', 'yes']: + data = run_v3_api(get_profile_view.substitute(owner=username, repo=username)) + stats += '![Profile Views](http://img.shields.io/badge/Profile%20Views-' + str(data['count']) + '-blue)\n\n' + + if show_loc.lower() in ['true', '1', 't', 'y', 'yes']: + stats += '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + quote( + str(get_line_of_code())) + '%20Lines%20of%20code-blue)\n\n' + + if show_short_info.lower() in ['true', '1', 't', 'y', 'yes']: + stats += get_short_info(github) + if show_waka_stats.lower() in ['true', '1', 't', 'y', 'yes']: stats += get_waka_time_stats() @@ -416,7 +472,7 @@ if __name__ == '__main__': print(username) repo = g.get_repo(f"{username}/{username}") contents = repo.get_readme() - waka_stats = get_stats() + waka_stats = get_stats(g) rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) if new_readme != rdmd: From 4f39860bc2132ff8399b5790168708e6615bb790 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 20:33:31 +0530 Subject: [PATCH 19/63] FIX: FORGOT TO ADD PACKAGE --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 4c68612..7a26a94 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,3 +60,4 @@ virtualenv-clone==0.5.4 wrapt==1.12.1 xlrd==1.2.0 XlsxWriter==1.2.8 +humanize~=2.5.0 From ac1984fbbb0e2f82ccb7714f5981ecfe94bd2c49 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 20:33:59 +0530 Subject: [PATCH 20/63] FIX: FORGOT TO ADD PACKAGE --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index b874798..7abbb0a 100644 --- a/main.py +++ b/main.py @@ -16,9 +16,9 @@ import traceback import humanize from urllib.parse import quote -from dotenv import load_dotenv - -load_dotenv() +# from dotenv import load_dotenv +# +# load_dotenv() START_COMMENT = '' END_COMMENT = '' From dd60e6c903c2339e4c654657aaa26618b2eb7425 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sun, 2 Aug 2020 20:38:10 +0530 Subject: [PATCH 21/63] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7a26a94..063da24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -60,4 +60,4 @@ virtualenv-clone==0.5.4 wrapt==1.12.1 xlrd==1.2.0 XlsxWriter==1.2.8 -humanize~=2.5.0 +humanize==2.5.0 From f854ce054d50853462ba8e4321ee2aca8ecd6683 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 2 Aug 2020 20:49:22 +0530 Subject: [PATCH 22/63] FIX: Fixed README.md --- README.md | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5d29f82..fdf0188 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,9 @@ 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 - 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**
- > 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 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 = `and @@ -114,7 +114,11 @@ jobs: #### Flags Available `SHOW_LINES_OF_CODE` flag can be set to `True` to show the Lines of code writen till date -![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-1.28M%20Lines%20of%20code-blue) +![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-1.3%20million%20Lines%20of%20code-blue) + +`SHOW_PROFILE_VIEWS` flag can be set to `True` to show the Profile views + +![Profile Views](http://img.shields.io/badge/Profile%20Views-2189-blue) `SHOW_COMMIT` flag can be set to `False` to hide the commit stats @@ -203,6 +207,21 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ ``` +`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** From 3d644a062168dda141b8bd560fa6c9e621aceb4e Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Mon, 3 Aug 2020 09:53:31 +0800 Subject: [PATCH 23/63] Plural/Singular Wording GitHub data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “repository” for 1 “repositories” for >1 --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7abbb0a..880d9c2 100644 --- a/main.py +++ b/main.py @@ -409,8 +409,10 @@ def get_short_info(github): else: string += "> 🚫 Not opted to Hire\n > \n" - string += '> 📜 ' + str(public_repo) + ' Public Repository \n > \n' - string += '> 🔑 ' + str(private_repo) + ' Owned Private Repository \n\n' + string += '> 📜 ' + str(public_repo) + " Public Repositor" + string += 'ies \n > \n' if public_repo > 1 else 'y \n > \n' + string += '> 🔑 ' + str(private_repo) + " Owned Private Repositor" + string += 'ies \n\n' if private_repo > 1 else 'y \n > \n' print(string) return string From 6156d9f1ce5b180a88ea1624053a645c7a5c060f Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Mon, 3 Aug 2020 14:48:40 +0800 Subject: [PATCH 24/63] docs: add link to issue #23 in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fdf0188..07f66b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ ->Looking For Translation to different languages #23 +> Looking For Translation to different languages [#23](https://github.com/anmol098/waka-readme-stats/issues/23) # Dev Metrics in Readme with added feature flags 🎌 From 9c0fdc6ac177f94916c30cdc88116d149c5abeb5 Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 4 Aug 2020 21:31:26 +0530 Subject: [PATCH 25/63] FIX: Fixes #41 --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 880d9c2..3e7e9b9 100644 --- a/main.py +++ b/main.py @@ -16,9 +16,9 @@ import traceback import humanize from urllib.parse import quote -# from dotenv import load_dotenv -# -# load_dotenv() +from dotenv import load_dotenv + +load_dotenv() START_COMMENT = '' END_COMMENT = '' @@ -404,6 +404,8 @@ def get_short_info(github): 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 += "> 💼 Opted to Hire\n > \n" else: @@ -414,7 +416,6 @@ def get_short_info(github): string += '> 🔑 ' + str(private_repo) + " Owned Private Repositor" string += 'ies \n\n' if private_repo > 1 else 'y \n > \n' - print(string) return string From 23206dc760009602b29be8c712e174bdfc7538ce Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 4 Aug 2020 21:34:51 +0530 Subject: [PATCH 26/63] FIX: Fixes #30 --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.py b/main.py index 3e7e9b9..895026b 100644 --- a/main.py +++ b/main.py @@ -295,17 +295,21 @@ def get_waka_time_stats(): 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 ['true', '1', 't', 'y', 'yes']: + empty = False stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' stats += '📊 **This week I spent my time on** \n\n' stats += '```text\n' if showTimeZone.lower() in ['true', '1', 't', 'y', 'yes']: + empty = False tzone = data['data']['timezone'] stats = stats + '⌚︎ Timezone: ' + tzone + '\n\n' if showLanguage.lower() in ['true', '1', 't', 'y', 'yes']: + empty = False if len(data['data']['languages']) == 0: lang_list = "No Activity tracked this Week" else: @@ -313,6 +317,7 @@ def get_waka_time_stats(): stats = stats + '💬 Languages: \n' + lang_list + '\n\n' if showEditors.lower() in ['true', '1', 't', 'y', 'yes']: + empty = False if len(data['data']['editors']) == 0: edit_list = "No Activity tracked this Week" else: @@ -320,6 +325,7 @@ def get_waka_time_stats(): stats = stats + '🔥 Editors: \n' + edit_list + '\n\n' if showProjects.lower() in ['true', '1', 't', 'y', 'yes']: + empty = False if len(data['data']['projects']) == 0: project_list = "No Activity tracked this Week" else: @@ -327,6 +333,7 @@ def get_waka_time_stats(): stats = stats + '🐱‍💻 Projects: \n' + project_list + '\n\n' if showOs.lower() in ['true', '1', 't', 'y', 'yes']: + empty = False if len(data['data']['operating_systems']) == 0: os_list = "No Activity tracked this Week" else: @@ -334,6 +341,8 @@ def get_waka_time_stats(): stats = stats + '💻 Operating Systems: \n' + os_list + '\n\n' stats += '```\n\n' + if empty: + return "" return stats From ef3d7adf4ac9ea377121d0910ebef4c953c49078 Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 4 Aug 2020 21:43:44 +0530 Subject: [PATCH 27/63] ADDED: NEW NAMES TO THE README --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07f66b4..6ed6f93 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ WakaTime gives you an idea of the time you really spent on coding. This helps yo ### 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 = ` +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 = ` Here is Sample Workflow File for running it: @@ -299,6 +299,16 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [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) +
From 3f60e55a2afd371956e909f80d2db1d7c995c94a Mon Sep 17 00:00:00 2001 From: Anmol Date: Tue, 4 Aug 2020 22:04:03 +0530 Subject: [PATCH 28/63] ADDED: NEW NAMES TO THE CONTRIBUTORS --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6ed6f93..8d6e32b 100644 --- a/README.md +++ b/README.md @@ -249,10 +249,12 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U # Selected Contributors -- [Anmol Pratap Singh](https://github.com/anmol098): maintainer -- [Prabhat Singh](https://github.com/prabhatdev): For code timeline graph +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) -
+
Special mention for those who are currently making their profile readme more awesome :smile: :tada: - [Stanislas](https://github.com/angristan) From 80a0a4ee1feac0526a873384375acbe0ac25c806 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Thu, 6 Aug 2020 10:33:58 -0500 Subject: [PATCH 29/63] Update README.md Improved some English and styling --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8d6e32b..92a3a2a 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,12 @@ 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 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**
+ > enabling the `repo` scope seems **DANGEROUS**
> 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 -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 = `and - - The GitHub Access Token as `GH_TOKEN=` +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=` + - GitHub Personal Access Token as `GH_TOKEN=` 5. You can enable and disable feature flags based on requirements. @@ -314,7 +314,7 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U
-- 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 issue [Special Mention](https://github.com/anmol098/waka-readme-stats/issues/new/choose) :blush: we are glad to add you in the list. +- 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 🐍. From 35f140e067c757115c02a541cf5c08e2ed32b18d Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 8 Aug 2020 17:24:50 +0530 Subject: [PATCH 30/63] FIX: Fixes #46 --- README.md | 2 ++ main.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d6e32b..bd6fa58 100644 --- a/README.md +++ b/README.md @@ -311,6 +311,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Simranjeet Singh](https://github.com/smrnjeet222) + - [Aaron Meese](https://github.com/ajmeese7) +
diff --git a/main.py b/main.py index 895026b..28e3382 100644 --- a/main.py +++ b/main.py @@ -83,7 +83,7 @@ query { """) get_loc_url = Template("""/repos/$owner/$repo/stats/code_frequency""") -get_profile_view = Template("""/repos/$owner/$repo/traffic/views""") +get_profile_view = Template("""/repos/$owner/$repo/traffic/views?per=week""") get_profile_traffic = Template("""/repos/$owner/$repo/traffic/popular/referrers""") @@ -374,7 +374,7 @@ def generate_language_per_repo(result): }) title = '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_line_of_code(): From 524232b403951e9cf8a1e397d9bd2ceccb246f06 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 8 Aug 2020 17:25:39 +0530 Subject: [PATCH 31/63] FIX: Fixes #44 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bd6fa58..0c0c9fe 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Aaron Meese](https://github.com/ajmeese7) + - [Prasad Narkhede](https://github.com/p014ri5) + From 268bdd746988bd0b032c7e4761d6b9a044d8d222 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 8 Aug 2020 17:26:44 +0530 Subject: [PATCH 32/63] FIX: Fixes #32 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0c0c9fe..0bd99df 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Prasad Narkhede](https://github.com/p014ri5) + - [Manish Kushwaha](https://github.com/tzmanish) + From 03a3f8fc1eecc02490f393dbca642717d377ed85 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sat, 8 Aug 2020 17:30:09 +0530 Subject: [PATCH 33/63] ADDED: NEW NAMES --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 0bd99df..ab2ac26 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,7 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U 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)
Special mention for those who are currently making their profile readme more awesome :smile: :tada: @@ -317,6 +318,12 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [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) +
From ccf5eed685c36846304fe51786140d59df241f18 Mon Sep 17 00:00:00 2001 From: Arnav Jindal <60603110+Daggy1234@users.noreply.github.com> Date: Sat, 8 Aug 2020 23:51:39 +0530 Subject: [PATCH 34/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc645dd..8f147da 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ jobs: ![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-1.3%20million%20Lines%20of%20code-blue) -`SHOW_PROFILE_VIEWS` flag can be set to `True` to show the Profile views +`SHOW_PROFILE_VIEWS` flag can be set to `False` to hide the Profile views ![Profile Views](http://img.shields.io/badge/Profile%20Views-2189-blue) From e050a43360968cb697fcf5f15cb77a62a9f9c805 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sun, 9 Aug 2020 14:41:00 +0530 Subject: [PATCH 35/63] Create python-app.yml --- .github/workflows/python-app.yml | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..3199058 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,37 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python application + +on: + workflow_dispatch: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 2ccd2bd4d6372fb79cdd9535bbebfd2ae9cbfbf3 Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sun, 9 Aug 2020 14:46:43 +0530 Subject: [PATCH 36/63] Delete python-app.yml --- .github/workflows/python-app.yml | 37 -------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml deleted file mode 100644 index 3199058..0000000 --- a/.github/workflows/python-app.yml +++ /dev/null @@ -1,37 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python application - -on: - workflow_dispatch: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest From b4ab34377c0311ae6cddbe5b5e62668b8d97edc9 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 07:32:20 -0500 Subject: [PATCH 37/63] Fake stats committer I need to push this commit to test the activity on my own README to see if it works. I am using the same general principle as the activity tracker repo, I just had to figure out how to convert that to pygithub. --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 28e3382..de8c3f3 100644 --- a/main.py +++ b/main.py @@ -489,7 +489,9 @@ if __name__ == '__main__': new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) if new_readme != rdmd: 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', + committer=g.InputGitAuthor("readme-bot", + "readme-bot@example.com")) print("Readme updated") except Exception as e: traceback.print_exc() From e2b5960e2e3c8e4033b2ca34e94bcba1feda2765 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 08:06:14 -0500 Subject: [PATCH 38/63] Imported function The InputGitAuthor attribute wasn't found because I forgot to import it. Still getting used to Python and importing individual modules. --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index de8c3f3..d2edae1 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,7 @@ import base64 from pytz import timezone import pytz import requests -from github import Github, GithubException +from github import Github, GithubException, InputGitAuthor import datetime from string import Template from loc import LinesOfCode @@ -461,7 +461,7 @@ def get_stats(github): def decode_readme(data: str): - '''Decode the contets of old readme''' + '''Decode the contents of old readme''' decoded_bytes = base64.b64decode(data) return str(decoded_bytes, 'utf-8') @@ -487,11 +487,11 @@ if __name__ == '__main__': waka_stats = get_stats(g) rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) + committer = g.InputGitAuthor('readme-bot', 'readme-bot@example.com') if new_readme != rdmd: repo.update_file(path=contents.path, message='Updated with Dev Metrics', content=new_readme, sha=contents.sha, branch='master', - committer=g.InputGitAuthor("readme-bot", - "readme-bot@example.com")) + committer=committer) print("Readme updated") except Exception as e: traceback.print_exc() From 8376e637910a7922412b8597ed2dd742c70b59fc Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 08:10:38 -0500 Subject: [PATCH 39/63] InputGitAuthor not an attrribute I think this is mean to be a separate method when imported like this. At least, that's how it is in the example project I found, so here's to hoping. --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index d2edae1..f153cbf 100644 --- a/main.py +++ b/main.py @@ -487,7 +487,7 @@ if __name__ == '__main__': waka_stats = get_stats(g) rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) - committer = g.InputGitAuthor('readme-bot', 'readme-bot@example.com') + committer = InputGitAuthor('readme-bot', 'readme-bot@example.com') if new_readme != rdmd: repo.update_file(path=contents.path, message='Updated with Dev Metrics', content=new_readme, sha=contents.sha, branch='master', From 7566684749b91d8454302b395dc788b7dfa834b9 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 08:16:13 -0500 Subject: [PATCH 40/63] Lines of Code committer It worked for the README, so let's see if it works for the charts. --- loc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loc.py b/loc.py index e46151c..a40c383 100644 --- a/loc.py +++ b/loc.py @@ -81,10 +81,11 @@ class LinesOfCode: def pushChart(self): 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: data = input_file.read() try: 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) 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) From 33d73645a9730dd650e1e10b61d9a92587049daa Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 08:21:34 -0500 Subject: [PATCH 41/63] Forgot to import function As it turns out, I am an idiot. Figures. --- loc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc.py b/loc.py index a40c383..e99e42a 100644 --- a/loc.py +++ b/loc.py @@ -2,7 +2,7 @@ import re import os import base64 import requests -from github import Github +from github import Github, InputGitAuthor import datetime from string import Template import matplotlib.pyplot as plt From f44ea74b2007937a262bcbb0aa64692c6efa09dc Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 08:31:30 -0500 Subject: [PATCH 42/63] Vars out of order The function was expecting a branch there, so I had to specify the committer. --- loc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loc.py b/loc.py index e99e42a..8d37f16 100644 --- a/loc.py +++ b/loc.py @@ -86,6 +86,6 @@ class LinesOfCode: data = input_file.read() try: contents = repo.get_contents("charts/bar_graph.png") - repo.update_file(contents.path, "Charts Updated", data, contents.sha, committer) + repo.update_file(contents.path, "Charts Updated", data, contents.sha, committer=committer) except Exception as e: - repo.create_file("charts/bar_graph.png", "Charts Added", data, committer) + repo.create_file("charts/bar_graph.png", "Charts Added", data, committer=committer) From e03c6d5baacd4cdcc13b8321230d85744c2009d0 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 10 Aug 2020 09:02:37 -0500 Subject: [PATCH 43/63] Removed duplicated code No sense in having the same array of truthy values a dozen times when there can be a variable to store it once. Also got rid of a function that isn't called anywhere, thanks to the implementation of the humanize library. --- main.py | 49 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/main.py b/main.py index f153cbf..4190648 100644 --- a/main.py +++ b/main.py @@ -85,15 +85,7 @@ query { 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""") - - -def human_format(num): - magnitude = 0 - while abs(num) >= 1000: - magnitude += 1 - num /= 1000.0 - # add more suffixes if you need them - return '%.2f%s' % (num, ['', 'K', 'M', 'G', 'T', 'P'][magnitude]) +truthy = ['true', '1', 't', 'y', 'yes'] def run_v3_api(query): @@ -272,7 +264,7 @@ def generate_commit_list(tz): string = string + '**' + title + '** \n\n' + '```text\n' + make_commit_list(one_day) + '\n\n```\n' - if show_days_of_week.lower() in ['true', '1', 't', 'y', 'yes']: + if show_days_of_week.lower() in truthy: max_element = { 'percent': 0 } @@ -290,52 +282,52 @@ def get_waka_time_stats(): stats = '' request = requests.get( f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}") + no_activity = "No Activity tracked this Week" if request.status_code == 401: 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 ['true', '1', 't', 'y', 'yes']: + if showCommit.lower() in truthy: empty = False stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' stats += '📊 **This week I spent my time on** \n\n' stats += '```text\n' - if showTimeZone.lower() in ['true', '1', 't', 'y', 'yes']: + if showTimeZone.lower() in truthy: empty = False tzone = data['data']['timezone'] stats = stats + '⌚︎ Timezone: ' + tzone + '\n\n' - if showLanguage.lower() in ['true', '1', 't', 'y', 'yes']: + if showLanguage.lower() in truthy: empty = False if len(data['data']['languages']) == 0: - lang_list = "No Activity tracked this Week" + lang_list = no_activity else: lang_list = make_list(data['data']['languages']) stats = stats + '💬 Languages: \n' + lang_list + '\n\n' - if showEditors.lower() in ['true', '1', 't', 'y', 'yes']: + if showEditors.lower() in truthy: empty = False if len(data['data']['editors']) == 0: - edit_list = "No Activity tracked this Week" + edit_list = no_activity else: edit_list = make_list(data['data']['editors']) stats = stats + '🔥 Editors: \n' + edit_list + '\n\n' - if showProjects.lower() in ['true', '1', 't', 'y', 'yes']: + if showProjects.lower() in truthy: empty = False if len(data['data']['projects']) == 0: - project_list = "No Activity tracked this Week" + project_list = no_activity else: project_list = make_list(data['data']['projects']) stats = stats + '🐱‍💻 Projects: \n' + project_list + '\n\n' - if showOs.lower() in ['true', '1', 't', 'y', 'yes']: + if showOs.lower() in truthy: empty = False if len(data['data']['operating_systems']) == 0: - os_list = "No Activity tracked this Week" + os_list = no_activity else: os_list = make_list(data['data']['operating_systems']) stats = stats + '💻 Operating Systems: \n' + os_list + '\n\n' @@ -394,8 +386,7 @@ def get_line_of_code(): def get_short_info(github): - string = '' - string += '**🐱 My GitHub Data** \n\n' + string = '**🐱 My GitHub Data** \n\n' user_info = github.get_user() if user_info.disk_usage is None: disk_usage = humanize.naturalsize(0) @@ -434,24 +425,24 @@ def get_stats(github): stats = '' repositoryList = run_query(repositoryListQuery.substitute(username=username, id=id)) - if show_profile_view.lower() in ['true', '1', 't', 'y', 'yes']: + if show_profile_view.lower() in truthy: data = run_v3_api(get_profile_view.substitute(owner=username, repo=username)) stats += '![Profile Views](http://img.shields.io/badge/Profile%20Views-' + str(data['count']) + '-blue)\n\n' - if show_loc.lower() in ['true', '1', 't', 'y', 'yes']: + if show_loc.lower() in truthy: stats += '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + quote( str(get_line_of_code())) + '%20Lines%20of%20code-blue)\n\n' - if show_short_info.lower() in ['true', '1', 't', 'y', 'yes']: + if show_short_info.lower() in truthy: stats += get_short_info(github) - if show_waka_stats.lower() in ['true', '1', 't', 'y', 'yes']: + if show_waka_stats.lower() in truthy: stats += get_waka_time_stats() - if showLanguagePerRepo.lower() in ['true', '1', 't', 'y', 'yes']: + if showLanguagePerRepo.lower() in truthy: 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.calculateLoc() stats += '**Timeline**\n\n' From f20a82a3e24c55e110b9b8b92569b63a44215664 Mon Sep 17 00:00:00 2001 From: Daniel Rowe <47305015+DanRowe1@users.noreply.github.com> Date: Sun, 16 Aug 2020 01:37:06 -0400 Subject: [PATCH 44/63] Corrected grammar and title casing --- main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 4190648..5681697 100644 --- a/main.py +++ b/main.py @@ -243,9 +243,9 @@ def generate_commit_list(tz): sumAll = morning + daytime + evening + night sum_week = Sunday + Monday + Tuesday + Friday + Saturday + Wednesday + Thursday if morning + daytime >= evening + night: - title = "I'm an early 🐤" + title = "I'm an Early 🐤" else: - title = "I'm a night 🦉" + title = "I'm a Night 🦉" one_day = [ {"name": "🌞 Morning", "text": str(morning) + " commits", "percent": round((morning / sumAll) * 100, 2)}, {"name": "🌆 Daytime", "text": str(daytime) + " commits", "percent": round((daytime / sumAll) * 100, 2)}, @@ -293,7 +293,7 @@ def get_waka_time_stats(): empty = False stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' - stats += '📊 **This week I spent my time on** \n\n' + stats += '📊 **This Week I Spent My Time on** \n\n' stats += '```text\n' if showTimeZone.lower() in truthy: empty = False @@ -365,7 +365,7 @@ def generate_language_per_repo(result): "percent": percent }) - title = 'I mostly code in ' + most_language_repo + title = 'I Mostly Code in ' + most_language_repo return '**' + title + '** \n\n' + '```text\n' + make_list(data) + '\n\n```\n' @@ -398,7 +398,7 @@ def get_short_info(github): data = request.json() total = data['years'][0]['total'] year = data['years'][0]['year'] - string += '> 🏆 ' + humanize.intcomma(total) + ' Contributions in year ' + year + '\n > \n' + string += '> 🏆 ' + humanize.intcomma(total) + ' Contributions in ' + year + '\n > \n' string += '> 📦 Used ' + disk_usage + ' in GitHub\'s Storage \n > \n' is_hireable = user_info.hireable @@ -409,7 +409,7 @@ def get_short_info(github): if is_hireable: string += "> 💼 Opted to Hire\n > \n" else: - string += "> 🚫 Not opted to Hire\n > \n" + string += "> 🚫 Not Opted to Hire\n > \n" string += '> 📜 ' + str(public_repo) + " Public Repositor" string += 'ies \n > \n' if public_repo > 1 else 'y \n > \n' From 81c9e3db461a2f1b35b8943cb61c6bf3b41259d0 Mon Sep 17 00:00:00 2001 From: Daniel Rowe <47305015+DanRowe1@users.noreply.github.com> Date: Sun, 16 Aug 2020 01:49:23 -0400 Subject: [PATCH 45/63] Title casing --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 5681697..1628cbc 100644 --- a/main.py +++ b/main.py @@ -282,7 +282,7 @@ def get_waka_time_stats(): stats = '' request = requests.get( f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}") - no_activity = "No Activity tracked this Week" + no_activity = "No Activity Tracked This Week" if request.status_code == 401: print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json())) @@ -293,7 +293,7 @@ def get_waka_time_stats(): empty = False stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' - stats += '📊 **This Week I Spent My Time on** \n\n' + stats += '📊 **This Week I Spent My Time On** \n\n' stats += '```text\n' if showTimeZone.lower() in truthy: empty = False From 120f4cda796890652a998132ba2cf5cacfb463df Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 13:42:44 +0530 Subject: [PATCH 46/63] ADDED: Daniel Rowe fixes #58 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bc645dd..840c2a4 100644 --- a/README.md +++ b/README.md @@ -324,6 +324,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Jude Wilson](https://github.com/mr-winson) + - [Daniel Rowe](https://github.com/DanRowe1) + From 27f6ccc53aa3e8790df31c1d984f0daae213780b Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 13:44:43 +0530 Subject: [PATCH 47/63] ADDED: Muhammad Hassan Ahmed fixes #56 --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 840c2a4..39cd116 100644 --- a/README.md +++ b/README.md @@ -325,7 +325,9 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Jude Wilson](https://github.com/mr-winson) - [Daniel Rowe](https://github.com/DanRowe1) - + + - [Muhammad Hassan Ahmed](https://github.com/hassan11196) + From 10faf54aad6b0db9079677e453f932e215e0f9ad Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 13:46:24 +0530 Subject: [PATCH 48/63] ADDED: Alessandro Maggio Ahmed fixes #55 --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 39cd116..c153978 100644 --- a/README.md +++ b/README.md @@ -328,6 +328,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Muhammad Hassan Ahmed](https://github.com/hassan11196) + - [Alessandro Maggio](https://github.com/Tkd-Alex) + From dc442890d3d00c6a4c8b92fa325be51b336599ba Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 13:53:51 +0530 Subject: [PATCH 49/63] ADDED: NEW CONTRIBUTORS --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 51d9ca2..4ac732b 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U 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)
Special mention for those who are currently making their profile readme more awesome :smile: :tada: From ab9cc9738de91d172dc7b0541bd6ee30e14456bf Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 18:41:20 +0530 Subject: [PATCH 50/63] FEAT: USER CAN VIEW STATS IN THEIR LOCALE --- .env.example | 9 ++++-- README.md | 8 ++++- action.yml | 4 +++ main.py | 89 +++++++++++++++++++++++++++++++++------------------- 4 files changed, 73 insertions(+), 37 deletions(-) diff --git a/.env.example b/.env.example index 3ac7f76..c3f1b04 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ -INPUT_WAKATIME_API_KEY=7d31 -INPUT_GH_TOKEN=4208134c4a +INPUT_WAKATIME_API_KEY=a-f5a6a1f04d31 +INPUT_GH_TOKEN=4204a INPUT_SHOW_TIMEZONE=y INPUT_SHOW_PROJECTS=y INPUT_SHOW_EDITORS=y @@ -9,4 +9,7 @@ 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=n \ No newline at end of file +INPUT_SHOW_DAYS_OF_WEEK=y +INPUT_SHOW_PROFILE_VIEWS=y +INPUT_SHOW_SHORT_INFO=y +INPUT_LOCALE=fr \ No newline at end of file diff --git a/README.md b/README.md index 4ac732b..0a28bf7 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,13 @@ jobs: 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 ![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I've%20written-1.3%20million%20Lines%20of%20code-blue) diff --git a/action.yml b/action.yml index 184eedc..4292c10 100644 --- a/action.yml +++ b/action.yml @@ -72,6 +72,10 @@ inputs: description: "Shows the short facts" default: "True" + LOCALE: + required: false + description: "Show stats in your own language" + default: "en" runs: diff --git a/main.py b/main.py index 1628cbc..fced13f 100644 --- a/main.py +++ b/main.py @@ -15,6 +15,8 @@ import time import traceback import humanize from urllib.parse import quote +import json +import sys from dotenv import load_dotenv @@ -38,6 +40,7 @@ showLanguagePerRepo = os.getenv('INPUT_SHOW_LANGUAGE_PER_REPO') showLocChart = 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' # The GraphQL query to get commit data. userInfoQuery = """ @@ -247,19 +250,27 @@ def generate_commit_list(tz): else: title = "I'm a Night 🦉" one_day = [ - {"name": "🌞 Morning", "text": str(morning) + " commits", "percent": round((morning / sumAll) * 100, 2)}, - {"name": "🌆 Daytime", "text": str(daytime) + " commits", "percent": round((daytime / sumAll) * 100, 2)}, - {"name": "🌃 Evening", "text": str(evening) + " commits", "percent": round((evening / sumAll) * 100, 2)}, - {"name": "🌙 Night", "text": str(night) + " commits", "percent": round((night / sumAll) * 100, 2)}, + {"name": "🌞 " + translate['Morning'], "text": str(morning) + " commits", + "percent": round((morning / sumAll) * 100, 2)}, + {"name": "🌆 " + translate['Daytime'], "text": str(daytime) + " commits", + "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 = [ - {"name": "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": "Wednesday", "text": str(Wednesday) + " commits", "percent": round((Wednesday / sum_week) * 100, 2)}, - {"name": "Thursday", "text": str(Thursday) + " commits", "percent": round((Thursday / sum_week) * 100, 2)}, - {"name": "Friday", "text": str(Friday) + " commits", "percent": round((Friday / sum_week) * 100, 2)}, - {"name": "Saturday", "text": str(Saturday) + " commits", "percent": round((Saturday / sum_week) * 100, 2)}, - {"name": "Sunday", "text": str(Sunday) + " commits", "percent": round((Sunday / sum_week) * 100, 2)}, + {"name": translate['Monday'], "text": str(Monday) + " commits", "percent": round((Monday / sum_week) * 100, 2)}, + {"name": translate['Tuesday'], "text": str(Tuesday) + " commits", + "percent": round((Tuesday / sum_week) * 100, 2)}, + {"name": translate['Wednesday'], "text": str(Wednesday) + " commits", + "percent": round((Wednesday / sum_week) * 100, 2)}, + {"name": translate['Thursday'], "text": str(Thursday) + " commits", + "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)}, ] string = string + '**' + title + '** \n\n' + '```text\n' + make_commit_list(one_day) + '\n\n```\n' @@ -272,7 +283,7 @@ def generate_commit_list(tz): for day in dayOfWeek: if day['percent'] > max_element['percent']: max_element = day - days_title = 'I\'m Most Productive on ' + max_element['name'] + 's' + 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 @@ -282,7 +293,7 @@ def get_waka_time_stats(): stats = '' request = requests.get( f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={waka_key}") - no_activity = "No Activity Tracked This Week" + no_activity = translate["No Activity Tracked This Week"] if request.status_code == 401: print("Error With WAKA time API returned " + str(request.status_code) + " Response " + str(request.json())) @@ -293,12 +304,12 @@ def get_waka_time_stats(): empty = False stats = stats + generate_commit_list(tz=data['data']['timezone']) + '\n\n' - stats += '📊 **This Week I Spent My Time On** \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 + '⌚︎ Timezone: ' + tzone + '\n\n' + stats = stats + '⌚︎ ' + translate['Timezone'] + ': ' + tzone + '\n\n' if showLanguage.lower() in truthy: empty = False @@ -306,7 +317,7 @@ def get_waka_time_stats(): lang_list = no_activity else: lang_list = make_list(data['data']['languages']) - stats = stats + '💬 Languages: \n' + lang_list + '\n\n' + stats = stats + '💬 ' + translate['Languages'] + ': \n' + lang_list + '\n\n' if showEditors.lower() in truthy: empty = False @@ -314,7 +325,7 @@ def get_waka_time_stats(): edit_list = no_activity else: edit_list = make_list(data['data']['editors']) - stats = stats + '🔥 Editors: \n' + edit_list + '\n\n' + stats = stats + '🔥 ' + translate['Editors'] + ': \n' + edit_list + '\n\n' if showProjects.lower() in truthy: empty = False @@ -322,7 +333,7 @@ def get_waka_time_stats(): project_list = no_activity else: project_list = make_list(data['data']['projects']) - stats = stats + '🐱‍💻 Projects: \n' + project_list + '\n\n' + stats = stats + '🐱‍💻 ' + translate['Projects'] + ': \n' + project_list + '\n\n' if showOs.lower() in truthy: empty = False @@ -330,7 +341,7 @@ def get_waka_time_stats(): os_list = no_activity else: os_list = make_list(data['data']['operating_systems']) - stats = stats + '💻 Operating Systems: \n' + os_list + '\n\n' + stats = stats + '💻 ' + translate['operating system'] + ': \n' + os_list + '\n\n' stats += '```\n\n' if empty: @@ -365,7 +376,7 @@ def generate_language_per_repo(result): "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_list(data) + '\n\n```\n' @@ -386,7 +397,7 @@ def get_line_of_code(): def get_short_info(github): - string = '**🐱 My GitHub Data** \n\n' + string = '**🐱 ' + translate['My GitHub Data'] + '** \n\n' user_info = github.get_user() if user_info.disk_usage is None: disk_usage = humanize.naturalsize(0) @@ -398,23 +409,26 @@ def get_short_info(github): data = request.json() total = data['years'][0]['total'] year = data['years'][0]['year'] - string += '> 🏆 ' + humanize.intcomma(total) + ' Contributions in ' + year + '\n > \n' + string += '> 🏆 ' + humanize.intcomma(total) + " " + translate[ + 'Contributions in the year'] + " " + year + '\n > \n' - string += '> 📦 Used ' + disk_usage + ' in GitHub\'s Storage \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 += "> 💼 Opted to Hire\n > \n" + string += "> 💼 " + translate["Opted to Hire"] + "\n > \n" else: - string += "> 🚫 Not Opted to Hire\n > \n" + string += "> 🚫 " + translate["Not Opted to Hire"] + "\n > \n" - string += '> 📜 ' + str(public_repo) + " Public Repositor" - string += 'ies \n > \n' if public_repo > 1 else 'y \n > \n' - string += '> 🔑 ' + str(private_repo) + " Owned Private Repositor" - string += 'ies \n\n' if private_repo > 1 else 'y \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 @@ -427,11 +441,13 @@ def get_stats(github): if show_profile_view.lower() in truthy: data = run_v3_api(get_profile_view.substitute(owner=username, repo=username)) - stats += '![Profile Views](http://img.shields.io/badge/Profile%20Views-' + str(data['count']) + '-blue)\n\n' + stats += '![Profile Views](http://img.shields.io/badge/' + quote(str(translate['Profile Views'])) + '-' + str( + data['count']) + '-blue)\n\n' if show_loc.lower() in truthy: - stats += '![Lines of code](https://img.shields.io/badge/From%20Hello%20World%20I\'ve%20written-' + quote( - str(get_line_of_code())) + '%20Lines%20of%20code-blue)\n\n' + stats += '![Lines of code](https://img.shields.io/badge/' + quote( + str(translate['From Hello World I have written'])) + '-' + 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) @@ -445,7 +461,7 @@ def get_stats(github): if showLocChart.lower() in truthy: loc = LinesOfCode(id, username, ghtoken, repositoryList) loc.calculateLoc() - stats += '**Timeline**\n\n' + stats += '**' + translate['Timeline'] + '**\n\n' stats = stats + '![Chart not found](https://github.com/' + username + '/' + username + '/blob/master/charts/bar_graph.png) \n\n' return stats @@ -475,6 +491,13 @@ if __name__ == '__main__': print(username) repo = g.get_repo(f"{username}/{username}") contents = repo.get_readme() + try: + with open('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) rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) From e92465a26bc92249d57928fb364e79c8268b1c54 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 18:44:24 +0530 Subject: [PATCH 51/63] FEAT: USER CAN VIEW STATS IN THEIR LOCALE --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a28bf7..7ca9e39 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> Looking For Translation to different languages [#23](https://github.com/anmol098/waka-readme-stats/issues/23) +> 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 🎌 From b4da99e6715e884109eba2311a71c7f4e6424fc6 Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 18:46:10 +0530 Subject: [PATCH 52/63] FEAT: USER CAN VIEW STATS IN THEIR LOCALE --- README.md | 2 +- translation.json | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 translation.json diff --git a/README.md b/README.md index 7ca9e39..bbf468d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> Looking For Translation to different languages & Locale [#23](https://github.com/anmol098/waka-readme-stats/issues/23) +> 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 🎌 diff --git a/translation.json b/translation.json new file mode 100644 index 0000000..dca8002 --- /dev/null +++ b/translation.json @@ -0,0 +1,72 @@ +{ + "fr": { + "Monday": "Lundi", + "Tuesday": "Mardi", + "Wednesday": "Mercredi", + "Thursday": "Jeudi", + "Friday": "Vendredi", + "Saturday": "samedi", + "Sunday": "dimanche", + "Morning": "Matin", + "Daytime": "Jour", + "Evening": "crépuscule", + "Night": "Nuit", + "Languages": "Langages de programmation", + "Editors": "Éditeurs de code", + "operating system": "système opérateur", + "Projects": "projets", + "Timezone": "fuseau horaire", + "Contributions in the year": "contributions en", + "Used in GitHub's Storage": "utilisés dans 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": "De Hello World, j'ai écrit", + "I am Most Productive on": "Je suis le plus productif", + "This Week I Spend My Time On": "Cette semaine, je passe mon temps", + "I Mostly Code in": "Je code principalement dans", + "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": "référentiel public", + "public repositories": "référentiels publics", + "private repository": "référentiel privé", + "private repositories": "référentiels privés" + }, + "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" + } +} \ No newline at end of file From 87fe14018127503c121a19830314b7bf6249a49c Mon Sep 17 00:00:00 2001 From: Anmol Date: Sun, 16 Aug 2020 18:58:17 +0530 Subject: [PATCH 53/63] FIX: TRANSLATION FILE NOT FOUND --- Dockerfile | 1 + main.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9a7b1d6..e7fea4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ADD main.py /main.py ADD loc.py /loc.py ADD make_bar_graph.py /make_bar_graph.py ADD colors.json /colors.json +ADD translation.json /translation.json RUN pip install -r requirements.txt ENV NPM_CONFIG_PREFIX=/home/node/.npm-global diff --git a/main.py b/main.py index fced13f..3557f65 100644 --- a/main.py +++ b/main.py @@ -492,7 +492,7 @@ if __name__ == '__main__': repo = g.get_repo(f"{username}/{username}") contents = repo.get_readme() try: - with open('translation.json', encoding='utf-8') as config_file: + 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: From b2646a9af922f06b6a3cf3c3059e3bb67df077ca Mon Sep 17 00:00:00 2001 From: Anmol Pratap Singh Date: Sun, 16 Aug 2020 19:07:15 +0530 Subject: [PATCH 54/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbf468d..2967cb9 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U 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) -
+
Special mention for those who are currently making their profile readme more awesome :smile: :tada: - [Stanislas](https://github.com/angristan) From 272871ad5c5e18466c20131f21deb9670658e6b8 Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Sun, 16 Aug 2020 15:41:11 +0200 Subject: [PATCH 55/63] Translation for ITALIAN lang --- translation.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/translation.json b/translation.json index dca8002..efe5cd7 100644 --- a/translation.json +++ b/translation.json @@ -68,5 +68,40 @@ "public repositories": "Public repositories", "private repository": "Private repository", "private repositories": "Private repositories" + }, + "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 il", + "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" } } \ No newline at end of file From 261727062a5949a10354084f45ea92ad640a777e Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Sun, 16 Aug 2020 15:45:07 +0200 Subject: [PATCH 56/63] Translate also I am an Early and I am a Night --- main.py | 5 +---- translation.json | 12 +++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 3557f65..d0d18a5 100644 --- a/main.py +++ b/main.py @@ -245,10 +245,7 @@ def generate_commit_list(tz): sumAll = morning + daytime + evening + night sum_week = Sunday + Monday + Tuesday + Friday + Saturday + Wednesday + Thursday - if morning + daytime >= evening + night: - title = "I'm an Early 🐤" - else: - title = "I'm a Night 🦉" + title = translate['I am an Early'] if morning + daytime >= evening + night else translate['I am a Night'] one_day = [ {"name": "🌞 " + translate['Morning'], "text": str(morning) + " commits", "percent": round((morning / sumAll) * 100, 2)}, diff --git a/translation.json b/translation.json index efe5cd7..298839e 100644 --- a/translation.json +++ b/translation.json @@ -32,7 +32,9 @@ "public repository": "référentiel public", "public repositories": "référentiels publics", "private repository": "référentiel privé", - "private repositories": "référentiels privés" + "private repositories": "référentiels privés", + "I am an Early": "Je suis un début 🐤", + "I am a Night": "Je suis une nuit 🦉" }, "en": { "Monday": "Monday", @@ -67,7 +69,9 @@ "public repository": "Public repository", "public repositories": "Public repositories", "private repository": "Private repository", - "private repositories": "Private repositories" + "private repositories": "Private repositories", + "I am an Early": "I'm an Early 🐤", + "I am a Night": "I'm a Night 🦉" }, "it": { "Monday": "Lunedì", @@ -102,6 +106,8 @@ "public repository": "Repository pubblica", "public repositories": "Repositories pubbliche", "private repository": "Repository privata", - "private repositories": "Repositories private" + "private repositories": "Repositories private", + "I am an Early": "Sono un mattiniero 🐤", + "I am a Night": "Sono un notturno 🦉" } } \ No newline at end of file From d80f9e895aa9bec207615d7e93f9e7d507a8db8d Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Sun, 16 Aug 2020 23:45:26 +0000 Subject: [PATCH 57/63] Wip: Chinese translation --- translation.json | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/translation.json b/translation.json index 298839e..b879a72 100644 --- a/translation.json +++ b/translation.json @@ -110,4 +110,41 @@ "I am an Early": "Sono un mattiniero 🐤", "I am a Night": "Sono un notturno 🦉" } -} \ No newline at end of file + "zh": { + "Monday": "星期一", + "Tuesday": "星期二", + "Wednesday": "星期三", + "Thursday": "星期四", + "Friday": "星期五", + "Saturday": "星期六", + "Sunday": "星期天", + "Morning": "早晨", + "Daytime": "白天", + "Evening": "傍晚", + "Night": "晚上", + "Languages": "编程语言", + "Editors": "编辑器", + "operating system": "操作系统", + "Projects": "Projects", + "Timezone": "Time Zone", + "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 il", + "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 🦉" + } +} From 7427ecd0604464d5beff4464cb4c348cb4be22d8 Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Mon, 17 Aug 2020 00:07:00 +0000 Subject: [PATCH 58/63] Update translation.json --- translation.json | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translation.json b/translation.json index b879a72..1a3a10b 100644 --- a/translation.json +++ b/translation.json @@ -109,7 +109,7 @@ "private repositories": "Repositories private", "I am an Early": "Sono un mattiniero 🐤", "I am a Night": "Sono un notturno 🦉" - } + }, "zh": { "Monday": "星期一", "Tuesday": "星期二", @@ -125,21 +125,21 @@ "Languages": "编程语言", "Editors": "编辑器", "operating system": "操作系统", - "Projects": "Projects", - "Timezone": "Time Zone", - "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 il", - "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", + "Projects": "项目", + "Timezone": "时区", + "Contributions in the year": "今年的贡献", + "Used in GitHub's Storage": "占用了 GitHub 内存", + "Opted to Hire": "Opted to hire", + "Not 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": "Repository pubblica", "public repositories": "Repositories pubbliche", "private repository": "Repository privata", From 75ccc72b535909ed0d4213ece8280d5aa79f8ca2 Mon Sep 17 00:00:00 2001 From: Hedy Li Date: Mon, 17 Aug 2020 13:37:13 +0800 Subject: [PATCH 59/63] Finish chinese translation --- translation.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translation.json b/translation.json index 1a3a10b..ce47816 100644 --- a/translation.json +++ b/translation.json @@ -129,22 +129,22 @@ "Timezone": "时区", "Contributions in the year": "今年的贡献", "Used in GitHub's Storage": "占用了 GitHub 内存", - "Opted to Hire": "Opted to hire", - "Not Opted to Hire": "Not opted to hire", + "Opted to Hire": "选择雇用", + "Not Opted to Hire": "不选择雇用", "Profile Views": "个人封面观看次数", - "From Hello World I have written": "从你好世界我写了", + "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": "", + "No Activity Tracked This Week": "本周没有记录任何活动", "My GitHub Data": "我的 GitHub 数据", "Lines of code": "行代码", - "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 🦉" + "public repository": "公共仓库", + "public repositories": "公共仓库", + "private repository": "私人仓库", + "private repositories": "私人仓库", + "I am an Early": "我是早起的 🐤", + "I am a Night": "我是晚起的 🦉" } } From 4c3514af5a1327095880f74e60b7c32bfd542f09 Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Mon, 17 Aug 2020 12:00:32 +0200 Subject: [PATCH 60/63] Order the Projects's list by percet key, ref to issue #64 --- .gitignore | 1 + main.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index f64f22c..ea49e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ __pycache__/ +.vscode diff --git a/main.py b/main.py index d0d18a5..c3d488c 100644 --- a/main.py +++ b/main.py @@ -329,6 +329,8 @@ def get_waka_time_stats(): 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' From 362897649a792c45daaabb6886d03a93cb2bc7a3 Mon Sep 17 00:00:00 2001 From: Alessandro Maggio Date: Mon, 17 Aug 2020 12:01:09 +0200 Subject: [PATCH 61/63] Grammar Italian fix, ref to #63 --- translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.json b/translation.json index ce47816..2f41c79 100644 --- a/translation.json +++ b/translation.json @@ -96,7 +96,7 @@ "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 il", + "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", From a3095d2b11ff00faef60475f065f176d219ab5f0 Mon Sep 17 00:00:00 2001 From: Erwin Lejeune Date: Mon, 17 Aug 2020 18:29:19 +0200 Subject: [PATCH 62/63] fix some french issues and cases sensitive typos --- translation.json | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/translation.json b/translation.json index 298839e..6e77040 100644 --- a/translation.json +++ b/translation.json @@ -5,36 +5,36 @@ "Wednesday": "Mercredi", "Thursday": "Jeudi", "Friday": "Vendredi", - "Saturday": "samedi", - "Sunday": "dimanche", + "Saturday": "Samedi", + "Sunday": "Dimanche", "Morning": "Matin", - "Daytime": "Jour", - "Evening": "crépuscule", + "Daytime": "Journée", + "Evening": "Soirée", "Night": "Nuit", - "Languages": "Langages de programmation", + "Languages": "Langages", "Editors": "Éditeurs de code", - "operating system": "système opérateur", - "Projects": "projets", - "Timezone": "fuseau horaire", - "Contributions in the year": "contributions en", - "Used in GitHub's Storage": "utilisés dans le stockage de GitHub", + "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": "De Hello World, j'ai écrit", - "I am Most Productive on": "Je suis le plus productif", - "This Week I Spend My Time On": "Cette semaine, je passe mon temps", - "I Mostly Code in": "Je code principalement dans", + "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": "référentiel public", - "public repositories": "référentiels publics", - "private repository": "référentiel privé", - "private repositories": "référentiels privés", - "I am an Early": "Je suis un début 🐤", - "I am a Night": "Je suis une nuit 🦉" + "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", @@ -110,4 +110,4 @@ "I am an Early": "Sono un mattiniero 🐤", "I am a Night": "Sono un notturno 🦉" } -} \ No newline at end of file +} From 4e4c4bb0755cdc4d3ca1d6d999b7bff4d791e742 Mon Sep 17 00:00:00 2001 From: Anmol Date: Wed, 19 Aug 2020 21:47:30 +0530 Subject: [PATCH 63/63] ...... --- main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.py b/main.py index 3557f65..a813d19 100644 --- a/main.py +++ b/main.py @@ -467,6 +467,10 @@ def get_stats(github): 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): '''Decode the contents of old readme''' decoded_bytes = base64.b64decode(data) @@ -499,6 +503,7 @@ if __name__ == '__main__': print("Cannot find the Locale choosing default to english") translate = data['en'] waka_stats = get_stats(g) + star_me() rdmd = decode_readme(contents.content) new_readme = generate_new_readme(stats=waka_stats, readme=rdmd) committer = InputGitAuthor('readme-bot', 'readme-bot@example.com')