From a63ca6e3a0d06c6bcd607dda0b5b0fb36d0d2c20 Mon Sep 17 00:00:00 2001 From: Purbayan Chowdhury Date: Mon, 27 Nov 2023 01:24:51 +0530 Subject: [PATCH] Added badge style --- README.md | 2 ++ action.yml | 5 +++++ sources/main.py | 6 +++--- sources/manager_environment.py | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 31da994a..b8485b12 100644 --- a/README.md +++ b/README.md @@ -260,6 +260,8 @@ CSS 2 repos █░░░░░░░░░░░░░░░░ | 2 | ⣿ | ⣀ | | 3 | ⬛ | ⬜ | +`BADGE_STYLE` flag can be set to flat, flat-square, plastic, for-the-badge, social + `DEBUG_LOGGING` flag can be set to increase action output verbosity, by default equals internal runner debug property **Timeline** diff --git a/action.yml b/action.yml index 8a413d84..9d6922a5 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" + BADGE_STYLE: + required: false + description: "Style for the badge maker (flat, flat-square, plastic, for-the-badge, social)" + default: "flat" + DEBUG_LOGGING: required: false description: "Whether to enable action debug logging" diff --git a/sources/main.py b/sources/main.py index 7368c9b0..13bb7789 100644 --- a/sources/main.py +++ b/sources/main.py @@ -170,18 +170,18 @@ async def get_stats() -> str: if data is None: DBM.p("WakaTime data unavailable!") else: - stats += f"![Code Time](http://img.shields.io/badge/{quote('Code Time')}-{quote(str(data['data']['text']))}-blue)\n\n" + stats += f"![Code Time](http://img.shields.io/badge/{quote('Code Time')}-{quote(str(data['data']['text']))}-blue?style={quote(EM.BADGE_STYLE)})\n\n" if EM.SHOW_PROFILE_VIEWS: DBM.i("Adding profile views info...") data = GHM.REMOTE.get_views_traffic(per="week") - stats += f"![Profile Views](http://img.shields.io/badge/{quote(FM.t('Profile Views'))}-{data['count']}-blue)\n\n" + stats += f"![Profile Views](http://img.shields.io/badge/{quote(FM.t('Profile Views'))}-{data['count']}-blue?style={quote(EM.BADGE_STYLE)})\n\n" if EM.SHOW_LINES_OF_CODE: DBM.i("Adding lines of code info...") total_loc = sum([yearly_data[y][q][d]["add"] for y in yearly_data.keys() for q in yearly_data[y].keys() for d in yearly_data[y][q].keys()]) data = f"{intword(total_loc)} {FM.t('Lines of code')}" - stats += f"![Lines of code](https://img.shields.io/badge/{quote(FM.t('From Hello World I have written'))}-{quote(data)}-blue)\n\n" + stats += f"![Lines of code](https://img.shields.io/badge/{quote(FM.t('From Hello World I have written'))}-{quote(data)}-blue?style={quote(EM.BADGE_STYLE)})\n\n" if EM.SHOW_SHORT_INFO: stats += await get_short_github_info() diff --git a/sources/manager_environment.py b/sources/manager_environment.py index 33bbee44..84ff7cbd 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")) + BADGE_STYLE = getenv("BADGE_STYLE", "flat") DEBUG_LOGGING = getenv("INPUT_DEBUG_LOGGING", "0").lower() in _TRUTHY DEBUG_RUN = getenv("DEBUG_RUN", "False").lower() in _TRUTHY