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

feat: custom wakatime api url #525

Open
wants to merge 2 commits 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 @@ -253,6 +253,8 @@ CSS 2 repos █░░░░░░░░░░░░░░░░

`IGNORED_REPOS` flag can be set to `"waka-readme-stats, my-first-repo"` (just an example) to ignore some repos you don’t want to be counted

`WAKATIME_API_URL` flag can be set if you are hosting your own wakatime compliant backend like [wakapi](https://github.com/muety/wakapi). You only have to supply your base url like so `https://your-own-wakapi.dev/api/`

`SYMBOL_VERSION` flag can be set symbol for progress bar (default: `1`)
| Version | Done block | Empty block |
|-------- | ---------- | ----------- |
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ inputs:
WAKATIME_API_KEY:
description: 'Your Wakatime API Key'
required: true

WAKATIME_API_URL:
description: 'Wakatime API URL'
required: false
default: "https://wakatime.com/api/"

SECTION_NAME:
description: 'Name used in readme to scope the updated section'
Expand Down
4 changes: 2 additions & 2 deletions sources/manager_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ async def init_download_manager(user_login: str):
"""
await DownloadManager.load_remote_resources(
linguist="https://cdn.jsdelivr.net/gh/github/linguist@master/lib/linguist/languages.yml",
waka_latest=f"https://wakatime.com/api/v1/users/current/stats/last_7_days?api_key={EM.WAKATIME_API_KEY}",
waka_all=f"https://wakatime.com/api/v1/users/current/all_time_since_today?api_key={EM.WAKATIME_API_KEY}",
waka_latest=f"{EM.WAKATIME_API_URL}v1/users/current/stats/last_7_days?api_key={EM.WAKATIME_API_KEY}",
waka_all=f"{EM.WAKATIME_API_URL}v1/users/current/all_time_since_today?api_key={EM.WAKATIME_API_KEY}",
github_stats=f"https://github-contributions.vercel.app/api/v1/{user_login}",
)

Expand Down
3 changes: 3 additions & 0 deletions sources/manager_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class EnvironmentManager:

GH_TOKEN = environ["INPUT_GH_TOKEN"]
WAKATIME_API_KEY = environ["INPUT_WAKATIME_API_KEY"]
WAKATIME_API_URL = getenv("INPUT_WAKATIME_API_URL", "https://wakatime.com/api/")
if not WAKATIME_API_URL.endswith("/"):
WAKATIME_API_URL += "/"

SECTION_NAME = getenv("INPUT_SECTION_NAME", "waka")
PULL_BRANCH_NAME = getenv("INPUT_PULL_BRANCH_NAME", "")
Expand Down