From ad5c77d81c293bcc5f63ccb83f46b1ba0e74f887 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 03:20:43 -0300 Subject: [PATCH 01/26] Add new symbol version --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 31da994a..f54df934 100644 --- a/README.md +++ b/README.md @@ -259,6 +259,7 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ | 1 | █ | ░ | | 2 | ⣿ | ⣀ | | 3 | ⬛ | ⬜ | +| 4 | ▰ | ▱ | `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property @@ -424,6 +425,8 @@ Contributions are welcome! ♥! Please share any features, and add unit tests! U - [Wyatt Walsh](https://www.github.com/wyattowalsh) - [Nithin Balaji](https://github.com/thenithinbalaji) + + - [Caupolicán Ré](https://github.com/caupolicanre) From e85eefeb0a6a72f95abe0e49e17f991801870bd8 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 03:24:05 -0300 Subject: [PATCH 02/26] Add new symbols for VERSION_4 --- sources/graphics_list_formatter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index d7c0a28b..d7483924 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -22,6 +22,7 @@ class Symbol(Enum): VERSION_1 = "█", "░" VERSION_2 = "⣿", "⣀" VERSION_3 = "⬛", "⬜" + VERSION_4 = "▰", "▱" @staticmethod def get_symbols(version: int) -> Tuple[str, str]: From 3a88e90ec30335e9be0e579cfa3b88c4e0dcec70 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 04:24:54 -0300 Subject: [PATCH 03/26] Add symbol style option to .env.example and action.yml --- .env.example | 1 + action.yml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.env.example b/.env.example index f46d8271..ea52ab7c 100644 --- a/.env.example +++ b/.env.example @@ -9,6 +9,7 @@ INPUT_SHOW_EDITORS=True INPUT_SHOW_OS=True INPUT_SHOW_LANGUAGE=True INPUT_SYMBOL_VERSION=1 +INPUT_SYMBOL_STYLE=█░ INPUT_SHOW_LINES_OF_CODE=True INPUT_SHOW_LOC_CHART=True INPUT_SHOW_PROFILE_VIEWS=True diff --git a/action.yml b/action.yml index 8a413d84..1a837fa5 100644 --- a/action.yml +++ b/action.yml @@ -142,6 +142,11 @@ inputs: description: "Version of the symbol block and empty of the progress bar" default: "1" + SYMBOL_STYLE: + required: false + description: "Style of the symbol block and empty of the progress bar" + default: "█░" + DEBUG_LOGGING: required: false description: "Whether to enable action debug logging" From f3d179dcbc9c132eeef8e217b84edb1b98d27602 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 04:33:20 -0300 Subject: [PATCH 04/26] Refactor progress bar symbol handling --- sources/graphics_list_formatter.py | 6 ++++-- sources/manager_environment.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index d7483924..bd555713 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -22,7 +22,6 @@ class Symbol(Enum): VERSION_1 = "█", "░" VERSION_2 = "⣿", "⣀" VERSION_3 = "⬛", "⬜" - VERSION_4 = "▰", "▱" @staticmethod def get_symbols(version: int) -> Tuple[str, str]: @@ -43,7 +42,10 @@ def make_graph(percent: float): :param percent: Completion percent of the progress bar. :return: The string progress bar representation. """ - done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION) + if len(EM.SYMBOL_STYLE) != 2: + done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION) + else: + done_block, empty_block = EM.SYMBOL_STYLE.split() percent_quart = round(percent / 4) return f"{done_block * percent_quart}{empty_block * (25 - percent_quart)}" diff --git a/sources/manager_environment.py b/sources/manager_environment.py index 33bbee44..850d5ee0 100644 --- a/sources/manager_environment.py +++ b/sources/manager_environment.py @@ -45,6 +45,7 @@ class EnvironmentManager: UPDATED_DATE_FORMAT = getenv("INPUT_UPDATED_DATE_FORMAT", "%d/%m/%Y %H:%M:%S") IGNORED_REPOS = getenv("INPUT_IGNORED_REPOS", "").replace(" ", "").split(",") SYMBOL_VERSION = int(getenv("INPUT_SYMBOL_VERSION")) + SYMBOL_STYLE: str = getenv("INPUT_SYMBOL_STYLE", "") DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY From ad6d3f4df57d594f3b6eaf62baa174abd9c41c3e Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 05:19:29 -0300 Subject: [PATCH 05/26] Remove default symbol style in action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1a837fa5..c7b4e4da 100644 --- a/action.yml +++ b/action.yml @@ -145,7 +145,7 @@ inputs: SYMBOL_STYLE: required: false description: "Style of the symbol block and empty of the progress bar" - default: "█░" + default: "" DEBUG_LOGGING: required: false From 937d0d35d9eb7cb2c423711d05e02a88280a5b3c Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 19:29:10 -0300 Subject: [PATCH 06/26] Remove unused symbol style --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f54df934..0e9ecd2a 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,6 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ | 1 | █ | ░ | | 2 | ⣿ | ⣀ | | 3 | ⬛ | ⬜ | -| 4 | ▰ | ▱ | `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property From 671b6738c97d53cc58172ac236a0e66a652dd7c8 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 19:36:53 -0300 Subject: [PATCH 07/26] Add SYMBOL_STYLE flag to change progress bar style --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0e9ecd2a..a9456a96 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,8 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ | 2 | ⣿ | ⣀ | | 3 | ⬛ | ⬜ | +`SYMBOL_STYLE` flag can be set to `"▰▱"` (just an example) to change the style of progress bar (default: `█░`). If the length of the string is not 2, the default style will be used. + `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property **Timeline** From 9618a41a6784908f8b89ad419dae3a5f85c97bd9 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 20:19:54 -0300 Subject: [PATCH 08/26] small change in SYMBOL_STYLE env variable README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a9456a96..eb6f8482 100644 --- a/README.md +++ b/README.md @@ -260,7 +260,7 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ | 2 | ⣿ | ⣀ | | 3 | ⬛ | ⬜ | -`SYMBOL_STYLE` flag can be set to `"▰▱"` (just an example) to change the style of progress bar (default: `█░`). If the length of the string is not 2, the default style will be used. +`SYMBOL_STYLE` flag can be set to `"▰▱"` (just an example) to change the style of progress bar (by default is empty). If the length of the string is not 2, the default symbol version will be used. `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property From 4384df8670b2d21fe41813320b9bb07e33f84995 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 20:39:52 -0300 Subject: [PATCH 09/26] Update action.yml and .env.example files with CODE_BLOCK_LANGUAGE env variable --- .env.example | 1 + action.yml | 327 +++++++++++++++++---------------- sources/manager_environment.py | 1 + 3 files changed, 168 insertions(+), 161 deletions(-) diff --git a/.env.example b/.env.example index ea52ab7c..fbe5df6c 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,7 @@ INPUT_SHOW_OS=True INPUT_SHOW_LANGUAGE=True INPUT_SYMBOL_VERSION=1 INPUT_SYMBOL_STYLE=█░ +INPUT_CODE_BLOCK_LANGUAGE=text INPUT_SHOW_LINES_OF_CODE=True INPUT_SHOW_LOC_CHART=True INPUT_SHOW_PROFILE_VIEWS=True diff --git a/action.yml b/action.yml index c7b4e4da..a5ce42a6 100644 --- a/action.yml +++ b/action.yml @@ -1,161 +1,166 @@ -name: 'Profile Readme Development Stats' -author: Anmol Pratap Singh -description: 'Are you an early 🐤 or a night 🦉? When are you most productive during the day? Let''s check out in your readme!' - -inputs: - GH_TOKEN: - description: 'GitHub access token with Repo scope' - required: true - default: ${{ github.token }} - - WAKATIME_API_KEY: - description: 'Your Wakatime API Key' - required: true - - SECTION_NAME: - description: 'Name used in readme to scope the updated section' - required: false - default: "waka" - - PULL_BRANCH_NAME: - required: false - description: "The branch to get the readme from" - default: "" - - PUSH_BRANCH_NAME: - required: false - description: "The branch to update the readme in" - default: "" - - SHOW_OS: - required: false - description: 'Show the list of OS Worked on In dev metrics' - default: "True" - - SHOW_PROJECTS: - required: false - description: 'Show the list of projects worked on in dev metrics' - default: "True" - - SHOW_EDITORS: - required: false - description: 'Show the Editors used in dev metrics' - default: "True" - - SHOW_TIMEZONE: - required: false - description: 'Show the time zone in the dev metrics' - default: "True" - - SHOW_COMMIT: - required: false - description: "Shows the number of commit graph in the dev metrics" - default: "True" - - SHOW_LANGUAGE: - required: false - description: "Show the Coding language used in dev metrics" - default: "True" - - SHOW_LINES_OF_CODE: - required: false - description: "Show the Total Lines of code written Badge till date" - default: "False" - - SHOW_LANGUAGE_PER_REPO: - required: false - description: "Show language or framework used across different repository" - default: "True" - - SHOW_LOC_CHART: - required: false - description: "" - default: "True" - - SHOW_DAYS_OF_WEEK: - required: false - description: "show day of week you are most productive" - default: "True" - - SHOW_PROFILE_VIEWS: - required: false - description: "Shows the current profile views" - default: "True" - - SHOW_SHORT_INFO: - required: false - description: "Shows the short facts" - default: "True" - - SHOW_UPDATED_DATE: - required: false - description: "Show updated date" - default: "True" - - SHOW_TOTAL_CODE_TIME: - required: false - description: "Show Total Time you have coded" - default: "True" - - COMMIT_BY_ME: - required: false - description: "Git commit with your own name and email" - default: "False" - - COMMIT_MESSAGE: - required: false - description: "Git commit message" - default: "Updated with Dev Metrics" - - COMMIT_USERNAME: - required: false - description: "Git commit custom username" - default: "" - - COMMIT_EMAIL: - required: false - description: "Git commit custom email" - default: "" - - COMMIT_SINGLE: - required: false - description: "Erase commit history on each commit" - default: "False" - - LOCALE: - required: false - description: "Show stats in your own language" - default: "en" - - UPDATED_DATE_FORMAT: - required: false - description: "Updated date format" - default: "%d/%m/%Y %H:%M:%S" - - IGNORED_REPOS: - required: false - description: "Repos you don't want to be counted" - default: "" - - SYMBOL_VERSION: - required: false - description: "Version of the symbol block and empty of the progress bar" - default: "1" - - SYMBOL_STYLE: - required: false - description: "Style of the symbol block and empty of the progress bar" - default: "" - - DEBUG_LOGGING: - required: false - description: "Whether to enable action debug logging" - default: ${{ runner.debug }} - -runs: - using: 'docker' - image: 'docker://wakareadmestats/waka-readme-stats:master' - -branding: - icon: 'activity' - color: 'orange' +name: 'Profile Readme Development Stats' +author: Anmol Pratap Singh +description: 'Are you an early 🐤 or a night 🦉? When are you most productive during the day? Let''s check out in your readme!' + +inputs: + GH_TOKEN: + description: 'GitHub access token with Repo scope' + required: true + default: ${{ github.token }} + + WAKATIME_API_KEY: + description: 'Your Wakatime API Key' + required: true + + SECTION_NAME: + description: 'Name used in readme to scope the updated section' + required: false + default: "waka" + + PULL_BRANCH_NAME: + required: false + description: "The branch to get the readme from" + default: "" + + PUSH_BRANCH_NAME: + required: false + description: "The branch to update the readme in" + default: "" + + SHOW_OS: + required: false + description: 'Show the list of OS Worked on In dev metrics' + default: "True" + + SHOW_PROJECTS: + required: false + description: 'Show the list of projects worked on in dev metrics' + default: "True" + + SHOW_EDITORS: + required: false + description: 'Show the Editors used in dev metrics' + default: "True" + + SHOW_TIMEZONE: + required: false + description: 'Show the time zone in the dev metrics' + default: "True" + + SHOW_COMMIT: + required: false + description: "Shows the number of commit graph in the dev metrics" + default: "True" + + SHOW_LANGUAGE: + required: false + description: "Show the Coding language used in dev metrics" + default: "True" + + SHOW_LINES_OF_CODE: + required: false + description: "Show the Total Lines of code written Badge till date" + default: "False" + + SHOW_LANGUAGE_PER_REPO: + required: false + description: "Show language or framework used across different repository" + default: "True" + + SHOW_LOC_CHART: + required: false + description: "" + default: "True" + + SHOW_DAYS_OF_WEEK: + required: false + description: "show day of week you are most productive" + default: "True" + + SHOW_PROFILE_VIEWS: + required: false + description: "Shows the current profile views" + default: "True" + + SHOW_SHORT_INFO: + required: false + description: "Shows the short facts" + default: "True" + + SHOW_UPDATED_DATE: + required: false + description: "Show updated date" + default: "True" + + SHOW_TOTAL_CODE_TIME: + required: false + description: "Show Total Time you have coded" + default: "True" + + COMMIT_BY_ME: + required: false + description: "Git commit with your own name and email" + default: "False" + + COMMIT_MESSAGE: + required: false + description: "Git commit message" + default: "Updated with Dev Metrics" + + COMMIT_USERNAME: + required: false + description: "Git commit custom username" + default: "" + + COMMIT_EMAIL: + required: false + description: "Git commit custom email" + default: "" + + COMMIT_SINGLE: + required: false + description: "Erase commit history on each commit" + default: "False" + + LOCALE: + required: false + description: "Show stats in your own language" + default: "en" + + UPDATED_DATE_FORMAT: + required: false + description: "Updated date format" + default: "%d/%m/%Y %H:%M:%S" + + IGNORED_REPOS: + required: false + description: "Repos you don't want to be counted" + default: "" + + SYMBOL_VERSION: + required: false + description: "Version of the symbol block and empty of the progress bar" + default: "1" + + SYMBOL_STYLE: + required: false + description: "Style of the symbol block and empty of the progress bar" + default: "" + + CODE_BLOCK_LANGUAGE: + required: false + description: "Language of the code block" + default: "text" + + DEBUG_LOGGING: + required: false + description: "Whether to enable action debug logging" + default: ${{ runner.debug }} + +runs: + using: 'docker' + image: 'docker://wakareadmestats/waka-readme-stats:master' + +branding: + icon: 'activity' + color: 'orange' diff --git a/sources/manager_environment.py b/sources/manager_environment.py index 850d5ee0..472610b5 100644 --- a/sources/manager_environment.py +++ b/sources/manager_environment.py @@ -46,6 +46,7 @@ class EnvironmentManager: IGNORED_REPOS = getenv("INPUT_IGNORED_REPOS", "").replace(" ", "").split(",") SYMBOL_VERSION = int(getenv("INPUT_SYMBOL_VERSION")) SYMBOL_STYLE: str = getenv("INPUT_SYMBOL_STYLE", "") + CODE_BLOCK_LANGUAGE: str = getenv("INPUT_CODE_BLOCK_LANGUAGE", "text") DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY From bed1496d32fb01a70a42124201e48154ca135e8c Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:03:32 -0300 Subject: [PATCH 10/26] Refactor code to use code block language in stats --- sources/graphics_list_formatter.py | 6 +++--- sources/main.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index bd555713..3ef53286 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -111,14 +111,14 @@ async def make_commit_day_time_list(time_zone: str, repositories: Dict, commit_d dt_texts = [f"{day_time} commits" for day_time in day_times] dt_percents = [0 if sum_day == 0 else round((day_time / sum_day) * 100, 2) for day_time in day_times] title = FM.t("I am an Early") if sum(day_times[0:2]) >= sum(day_times[2:4]) else FM.t("I am a Night") - stats += f"**{title}** \n\n```text\n{make_list(names=dt_names, texts=dt_texts, percents=dt_percents, top_num=7, sort=False)}\n```\n" + stats += f"**{title}** \n\n```{EM.CODE_BLOCK_LANGUAGE}\n{make_list(names=dt_names, texts=dt_texts, percents=dt_percents, top_num=7, sort=False)}\n```\n" if EM.SHOW_DAYS_OF_WEEK: wd_names = [FM.t(week_day) for week_day in WEEK_DAY_NAMES] wd_texts = [f"{week_day} commits" for week_day in week_days] wd_percents = [0 if sum_week == 0 else round((week_day / sum_week) * 100, 2) for week_day in week_days] title = FM.t("I am Most Productive on") % wd_names[wd_percents.index(max(wd_percents))] - stats += f"📅 **{title}** \n\n```text\n{make_list(names=wd_names, texts=wd_texts, percents=wd_percents, top_num=7, sort=False)}\n```\n" + stats += f"📅 **{title}** \n\n```{EM.CODE_BLOCK_LANGUAGE}\n{make_list(names=wd_names, texts=wd_texts, percents=wd_percents, top_num=7, sort=False)}\n```\n" return stats @@ -143,4 +143,4 @@ def make_language_per_repo_list(repositories: Dict) -> str: top_language = max(list(language_count.keys()), key=lambda x: language_count[x]["count"]) title = f"**{FM.t('I Mostly Code in') % top_language}** \n\n" if len(repos_with_language) > 0 else "" - return f"{title}```text\n{make_list(names=names, texts=texts, percents=percents)}\n```\n\n" + return f"{title}```{EM.CODE_BLOCK_LANGUAGE}\n{make_list(names=names, texts=texts, percents=percents)}\n```\n\n" diff --git a/sources/main.py b/sources/main.py index 7368c9b0..0bb8ffaa 100644 --- a/sources/main.py +++ b/sources/main.py @@ -40,7 +40,7 @@ async def get_waka_time_stats(repositories: Dict, commit_dates: Dict) -> str: if EM.SHOW_TIMEZONE or EM.SHOW_LANGUAGE or EM.SHOW_EDITORS or EM.SHOW_PROJECTS or EM.SHOW_OS: no_activity = FM.t("No Activity Tracked This Week") - stats += f"📊 **{FM.t('This Week I Spend My Time On')}** \n\n```text\n" + stats += f"📊 **{FM.t('This Week I Spend My Time On')}** \n\n```{EM.CODE_BLOCK_LANGUAGE}\n" if EM.SHOW_TIMEZONE: DBM.i("Adding user timezone info...") From 3a6d86ad1ccc7e28f56c7bbae7172a7f18fc3c40 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:03:42 -0300 Subject: [PATCH 11/26] Update README.md with code block language flag --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eb6f8482..28746522 100644 --- a/README.md +++ b/README.md @@ -262,6 +262,8 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ `SYMBOL_STYLE` flag can be set to `"▰▱"` (just an example) to change the style of progress bar (by default is empty). If the length of the string is not 2, the default symbol version will be used. +`CODE_BLOCK_LANGUAGE` flag can be set to `"python"` (just an example) to change the language of code blocks (by default is `"text"`). Here is a [list](https://github.com/jincheng9/markdown_supported_languages) of the language code blocks supported by github + `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property **Timeline** From 42d825e464b9fce6743cd676a46662a555153289 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:18:48 -0300 Subject: [PATCH 12/26] Update action.yml to test actions behavior --- action.yml | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index a5ce42a6..670a5d1d 100644 --- a/action.yml +++ b/action.yml @@ -158,8 +158,46 @@ inputs: default: ${{ runner.debug }} runs: - using: 'docker' - image: 'docker://wakareadmestats/waka-readme-stats:master' + using: 'ubuntu-latest' + steps: + - uses: actions/checkout@v2 + - uses: anmol098/waka-readme-stats@master + with: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} + SECTION_NAME: ${{ inputs.SECTION_NAME }} + PULL_BRANCH_NAME: ${{ inputs.PULL_BRANCH_NAME }} + PUSH_BRANCH_NAME: ${{ inputs.PUSH_BRANCH_NAME }} + SHOW_OS: ${{ inputs.SHOW_OS }} + SHOW_PROJECTS: ${{ inputs.SHOW_PROJECTS }} + SHOW_EDITORS: ${{ inputs.SHOW_EDITORS }} + SHOW_TIMEZONE: ${{ inputs.SHOW_TIMEZONE }} + SHOW_COMMIT: ${{ inputs.SHOW_COMMIT }} + SHOW_LANGUAGE: ${{ inputs.SHOW_LANGUAGE }} + SHOW_LINES_OF_CODE: ${{ inputs.SHOW_LINES_OF_CODE }} + SHOW_LANGUAGE_PER_REPO: ${{ inputs.SHOW_LANGUAGE_PER_REPO }} + SHOW_LOC_CHART: ${{ inputs.SHOW_LOC_CHART }} + SHOW_DAYS_OF_WEEK: ${{ inputs.SHOW_DAYS_OF_WEEK }} + SHOW_PROFILE_VIEWS: ${{ inputs.SHOW_PROFILE_VIEWS }} + SHOW_SHORT_INFO: ${{ inputs.SHOW_SHORT_INFO }} + SHOW_UPDATED_DATE: ${{ inputs.SHOW_UPDATED_DATE }} + SHOW_TOTAL_CODE_TIME: ${{ inputs.SHOW_TOTAL_CODE_TIME }} + COMMIT_BY_ME: ${{ inputs.COMMIT_BY_ME }} + COMMIT_MESSAGE: ${{ inputs.COMMIT_MESSAGE }} + COMMIT_USERNAME: ${{ inputs.COMMIT_USERNAME }} + COMMIT_EMAIL: ${{ inputs.COMMIT_EMAIL }} + COMMIT_SINGLE: ${{ inputs.COMMIT_SINGLE }} + LOCALE: ${{ inputs.LOCALE }} + UPDATED_DATE_FORMAT: ${{ inputs.UPDATED_DATE_FORMAT }} + IGNORED_REPOS: ${{ inputs.IGNORED_REPOS }} + SYMBOL_VERSION: ${{ inputs.SYMBOL_VERSION }} + SYMBOL_STYLE: ${{ inputs.SYMBOL_STYLE }} + CODE_BLOCK_LANGUAGE: ${{ inputs.CODE_BLOCK_LANGUAGE }} + DEBUG_LOGGING: ${{ inputs.DEBUG_LOGGING }} + +# runs: +# using: 'docker' +# image: 'docker://wakareadmestats/waka-readme-stats:master' branding: icon: 'activity' From c37ff5570da0740d423204393e3a9844c4676e73 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:20:41 -0300 Subject: [PATCH 13/26] Small change to test action --- action.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/action.yml b/action.yml index 670a5d1d..61a7424c 100644 --- a/action.yml +++ b/action.yml @@ -159,41 +159,6 @@ inputs: runs: using: 'ubuntu-latest' - steps: - - uses: actions/checkout@v2 - - uses: anmol098/waka-readme-stats@master - with: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} - SECTION_NAME: ${{ inputs.SECTION_NAME }} - PULL_BRANCH_NAME: ${{ inputs.PULL_BRANCH_NAME }} - PUSH_BRANCH_NAME: ${{ inputs.PUSH_BRANCH_NAME }} - SHOW_OS: ${{ inputs.SHOW_OS }} - SHOW_PROJECTS: ${{ inputs.SHOW_PROJECTS }} - SHOW_EDITORS: ${{ inputs.SHOW_EDITORS }} - SHOW_TIMEZONE: ${{ inputs.SHOW_TIMEZONE }} - SHOW_COMMIT: ${{ inputs.SHOW_COMMIT }} - SHOW_LANGUAGE: ${{ inputs.SHOW_LANGUAGE }} - SHOW_LINES_OF_CODE: ${{ inputs.SHOW_LINES_OF_CODE }} - SHOW_LANGUAGE_PER_REPO: ${{ inputs.SHOW_LANGUAGE_PER_REPO }} - SHOW_LOC_CHART: ${{ inputs.SHOW_LOC_CHART }} - SHOW_DAYS_OF_WEEK: ${{ inputs.SHOW_DAYS_OF_WEEK }} - SHOW_PROFILE_VIEWS: ${{ inputs.SHOW_PROFILE_VIEWS }} - SHOW_SHORT_INFO: ${{ inputs.SHOW_SHORT_INFO }} - SHOW_UPDATED_DATE: ${{ inputs.SHOW_UPDATED_DATE }} - SHOW_TOTAL_CODE_TIME: ${{ inputs.SHOW_TOTAL_CODE_TIME }} - COMMIT_BY_ME: ${{ inputs.COMMIT_BY_ME }} - COMMIT_MESSAGE: ${{ inputs.COMMIT_MESSAGE }} - COMMIT_USERNAME: ${{ inputs.COMMIT_USERNAME }} - COMMIT_EMAIL: ${{ inputs.COMMIT_EMAIL }} - COMMIT_SINGLE: ${{ inputs.COMMIT_SINGLE }} - LOCALE: ${{ inputs.LOCALE }} - UPDATED_DATE_FORMAT: ${{ inputs.UPDATED_DATE_FORMAT }} - IGNORED_REPOS: ${{ inputs.IGNORED_REPOS }} - SYMBOL_VERSION: ${{ inputs.SYMBOL_VERSION }} - SYMBOL_STYLE: ${{ inputs.SYMBOL_STYLE }} - CODE_BLOCK_LANGUAGE: ${{ inputs.CODE_BLOCK_LANGUAGE }} - DEBUG_LOGGING: ${{ inputs.DEBUG_LOGGING }} # runs: # using: 'docker' From 32bad519b2912d8dae3d55ac4bb6d77fcfbce73f Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:30:08 -0300 Subject: [PATCH 14/26] Testing action with composite --- action.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 61a7424c..af99f22a 100644 --- a/action.yml +++ b/action.yml @@ -158,7 +158,26 @@ inputs: default: ${{ runner.debug }} runs: - using: 'ubuntu-latest' + using: 'composite' + steps: + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Dependencies + run: pip install -r requirements.txt + shell: bash + + - name: Pass Inputs to Shell + run: | + echo "INPUT_NUM=${{ inputs.num }}" >> $GITHUB_ENV + shell: bash + + - name: Run main script + id: main-script + run: python sources/main.py + shell: bash # runs: # using: 'docker' From fd0a05b08cefa960bfceb12bc3fbea6148cde338 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:34:50 -0300 Subject: [PATCH 15/26] Update pip installation and add conditional check for requirements.txt --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index af99f22a..1ad119f8 100644 --- a/action.yml +++ b/action.yml @@ -166,7 +166,9 @@ runs: python-version: '3.11' - name: Install Dependencies - run: pip install -r requirements.txt + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi shell: bash - name: Pass Inputs to Shell From 50c666644c234c31887c9999300d6e3d139eb08e Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:39:50 -0300 Subject: [PATCH 16/26] Update run command in action.yml --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1ad119f8..fed640f8 100644 --- a/action.yml +++ b/action.yml @@ -178,7 +178,8 @@ runs: - name: Run main script id: main-script - run: python sources/main.py + run: | + python ${{ github.workspace }}/sources/main.py shell: bash # runs: From 44acf0a3b15fa0570c7c41de507f7d16f9552863 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:52:18 -0300 Subject: [PATCH 17/26] Update action.yml to install dependencies and run main script --- action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index fed640f8..778038f6 100644 --- a/action.yml +++ b/action.yml @@ -168,7 +168,7 @@ runs: - name: Install Dependencies run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install -r requirements.txt shell: bash - name: Pass Inputs to Shell @@ -177,10 +177,12 @@ runs: shell: bash - name: Run main script + uses: caupolicanre/waka-readme-stats@customize_text_field id: main-script run: | - python ${{ github.workspace }}/sources/main.py - shell: bash + python /home/runner/work/caupolicanre/waka-readme-stats/sources/main.py + + # runs: # using: 'docker' From 4d9360d423ff7a70d5f24bb6cb30055dd45b8624 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 21:59:55 -0300 Subject: [PATCH 18/26] Update action.yml to use Docker for running the script --- action.yml | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/action.yml b/action.yml index 778038f6..a4f61baa 100644 --- a/action.yml +++ b/action.yml @@ -157,32 +157,34 @@ inputs: description: "Whether to enable action debug logging" default: ${{ runner.debug }} -runs: - using: 'composite' - steps: - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - shell: bash - - - name: Pass Inputs to Shell - run: | - echo "INPUT_NUM=${{ inputs.num }}" >> $GITHUB_ENV - shell: bash - - - name: Run main script - uses: caupolicanre/waka-readme-stats@customize_text_field - id: main-script - run: | - python /home/runner/work/caupolicanre/waka-readme-stats/sources/main.py - +# runs: +# using: 'composite' +# steps: +# - name: Install Python +# uses: actions/setup-python@v4 +# with: +# python-version: '3.11' + +# - name: Install Dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -r requirements.txt +# shell: bash + +# - name: Pass Inputs to Shell +# run: | +# echo "INPUT_NUM=${{ inputs.num }}" >> $GITHUB_ENV +# shell: bash + +# - name: Run main script +# uses: caupolicanre/waka-readme-stats@customize_text_field +# id: main-script +# run: | +# python /home/runner/work/caupolicanre/waka-readme-stats/sources/main.py +runs: + using: "docker" + image: "dockerfile" # runs: # using: 'docker' From 8b4f18fcce5bcd3b70cc873bbb12112c3f268a44 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 22:01:48 -0300 Subject: [PATCH 19/26] Fix Dockerfile casing --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a4f61baa..bb25eb09 100644 --- a/action.yml +++ b/action.yml @@ -184,7 +184,7 @@ inputs: runs: using: "docker" - image: "dockerfile" + image: "Dockerfile" # runs: # using: 'docker' From 131f17f1fe6012789ba97ebc3c0014a06c41d496 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 22:10:00 -0300 Subject: [PATCH 20/26] Fix symbol style check in make_graph function --- sources/graphics_list_formatter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index 3ef53286..ccbafa34 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -42,9 +42,9 @@ def make_graph(percent: float): :param percent: Completion percent of the progress bar. :return: The string progress bar representation. """ - if len(EM.SYMBOL_STYLE) != 2: + if len(EM.SYMBOL_STYLE) == "": done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION) - else: + elif len(EM.SYMBOL_STYLE) == 2: done_block, empty_block = EM.SYMBOL_STYLE.split() percent_quart = round(percent / 4) return f"{done_block * percent_quart}{empty_block * (25 - percent_quart)}" From 98b370256725642f97f977e1a04c6661d86fa139 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 22:12:50 -0300 Subject: [PATCH 21/26] Fix symbol style assignment in make_graph function --- sources/graphics_list_formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index ccbafa34..2e680e62 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -45,7 +45,7 @@ def make_graph(percent: float): if len(EM.SYMBOL_STYLE) == "": done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION) elif len(EM.SYMBOL_STYLE) == 2: - done_block, empty_block = EM.SYMBOL_STYLE.split() + done_block, empty_block = EM.SYMBOL_STYLE[0], EM.SYMBOL_STYLE[1] percent_quart = round(percent / 4) return f"{done_block * percent_quart}{empty_block * (25 - percent_quart)}" From 437c0f161d887eac8edffc82d3a1ecd805105917 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 22:22:36 -0300 Subject: [PATCH 22/26] Fix progress bar symbol style bug --- sources/graphics_list_formatter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/graphics_list_formatter.py b/sources/graphics_list_formatter.py index 2e680e62..b416dad9 100644 --- a/sources/graphics_list_formatter.py +++ b/sources/graphics_list_formatter.py @@ -42,10 +42,10 @@ def make_graph(percent: float): :param percent: Completion percent of the progress bar. :return: The string progress bar representation. """ - if len(EM.SYMBOL_STYLE) == "": + if len(EM.SYMBOL_STYLE) == 2: + done_block, empty_block = EM.SYMBOL_STYLE[0], EM.SYMBOL_STYLE[1] + else: done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION) - elif len(EM.SYMBOL_STYLE) == 2: - done_block, empty_block = EM.SYMBOL_STYLE[0], EM.SYMBOL_STYLE[1] percent_quart = round(percent / 4) return f"{done_block * percent_quart}{empty_block * (25 - percent_quart)}" From 3f4bd8c84fb7f7dc459f3fbdae996fccdbba47db Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Sun, 3 Dec 2023 22:22:54 -0300 Subject: [PATCH 23/26] Remove commented out code and update runs section --- action.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/action.yml b/action.yml index bb25eb09..98d4cac6 100644 --- a/action.yml +++ b/action.yml @@ -157,31 +157,6 @@ inputs: description: "Whether to enable action debug logging" default: ${{ runner.debug }} -# runs: -# using: 'composite' -# steps: -# - name: Install Python -# uses: actions/setup-python@v4 -# with: -# python-version: '3.11' - -# - name: Install Dependencies -# run: | -# python -m pip install --upgrade pip -# pip install -r requirements.txt -# shell: bash - -# - name: Pass Inputs to Shell -# run: | -# echo "INPUT_NUM=${{ inputs.num }}" >> $GITHUB_ENV -# shell: bash - -# - name: Run main script -# uses: caupolicanre/waka-readme-stats@customize_text_field -# id: main-script -# run: | -# python /home/runner/work/caupolicanre/waka-readme-stats/sources/main.py - runs: using: "docker" image: "Dockerfile" From 025f504a8d7be1f6d2143b4ffae401a167b194ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caupolic=C3=A1n=20R=C3=A9?= <110579577+caupolicanre@users.noreply.github.com> Date: Sun, 3 Dec 2023 22:59:43 -0300 Subject: [PATCH 24/26] Update action.yml --- action.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 98d4cac6..a5ce42a6 100644 --- a/action.yml +++ b/action.yml @@ -158,12 +158,8 @@ inputs: default: ${{ runner.debug }} runs: - using: "docker" - image: "Dockerfile" - -# runs: -# using: 'docker' -# image: 'docker://wakareadmestats/waka-readme-stats:master' + using: 'docker' + image: 'docker://wakareadmestats/waka-readme-stats:master' branding: icon: 'activity' From b11cac29e98ebe934b60ba2af231e0c373c157fe Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Mon, 4 Dec 2023 12:40:37 -0300 Subject: [PATCH 25/26] Rollback to upstream original 'action.yml' file I reestablished in git the original action file --- action.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/action.yml b/action.yml index a5ce42a6..c52bf1b4 100644 --- a/action.yml +++ b/action.yml @@ -142,16 +142,6 @@ inputs: description: "Version of the symbol block and empty of the progress bar" default: "1" - SYMBOL_STYLE: - required: false - description: "Style of the symbol block and empty of the progress bar" - default: "" - - CODE_BLOCK_LANGUAGE: - required: false - description: "Language of the code block" - default: "text" - DEBUG_LOGGING: required: false description: "Whether to enable action debug logging" From 2ea7da6889bc3779456ff5b8e4e3aa602b51f888 Mon Sep 17 00:00:00 2001 From: caupolicanre Date: Mon, 4 Dec 2023 12:44:53 -0300 Subject: [PATCH 26/26] Add new env variables to action.yml --- action.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/action.yml b/action.yml index c52bf1b4..a5ce42a6 100644 --- a/action.yml +++ b/action.yml @@ -142,6 +142,16 @@ inputs: description: "Version of the symbol block and empty of the progress bar" default: "1" + SYMBOL_STYLE: + required: false + description: "Style of the symbol block and empty of the progress bar" + default: "" + + CODE_BLOCK_LANGUAGE: + required: false + description: "Language of the code block" + default: "text" + DEBUG_LOGGING: required: false description: "Whether to enable action debug logging"