Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added badge style #493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions sources/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions sources/manager_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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