GitHub Action
Waka - Readme
WakaTime weekly metrics on your profile readme.
💬 Forum | GitHub discussions
Nope? Skip to prep work.
WakaTime gives you an idea of the time you spent on coding. This helps you boost your productivity and competitive edge.
- Head over to https://wakatime.com/ and create an account.
- After logging in get your WakaTime API Key from https://wakatime.com/api-key/.
- Install WakaTime plugin in your favorite editor / IDE.
- Paste in your API key to start telemetry.
ℹ️ Info | You can read WakaTime help to know more about configurations. Alternatively, you can also fetch data from WakaTime compatible services like Wakapi or Hakatime.
A GitHub repository and a README.md
file is required. We'll be making use of readme in the profile repository.
-
Save the
README.md
file after copy-pasting the following special comments. Your dev-metics will show up in between.<!--START_SECTION:waka--> <!--END_SECTION:waka-->
<!--START_SECTION: -->
and<!--END_SECTION: -->
are placeholders and must be retained as is. Whereas "waka
" can be replaced by any alphanumeric string. See #Tweaks section for more. -
Navigate to your repo's
Settings > Secrets
and add a new secret namedWAKATIME_API_KEY
with your API key as it's value.Or use the url https://github.com/USERNAME/USERNAME/settings/secrets/actions/new by replacing the
USERNAME
with your own username.- If you're not using profile repository, add another secret named
GH_TOKEN
and insert your GitHub token* in place of value.
- If you're not using profile repository, add another secret named
-
Create a new workflow file (
waka-readme.yml
) inside.github/workflows/
folder of your repository. You can create it from a template using the actions tab of your repository too. -
Clear any existing contents, add the following lines and save the
waka-readme.yml
workflow file.name: Waka Readme on: workflow_dispatch: # for manual workflow trigger schedule: - cron: "0 0 * * *" # runs at every 12AM UTC jobs: update-readme: name: WakaReadme DevMetrics runs-on: ubuntu-latest steps: - uses: athul/waka-readme@master with: WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} # following flags are required, only if this is not on # profile readme, remove the leading `#` to use them #GH_TOKEN: ${{ secrets.GH_TOKEN }} #REPOSITORY: <gh_username/gh_username>
Refer #Example section for a full blown workflow file.
There are many flags that you can tweak as you wish!
Environment flag | Options (Default , Other , ...) |
Description |
---|---|---|
API_BASE_URL |
https://wakatime.com/api , https://wakapi.dev/api , https://hakatime.mtx-dev.xyz/api |
Use WakaTime compatible services like Wakapi & Hakatime |
REPOSITORY |
<gh_username>/<gh_username> , <gh_username>/<repo_name> |
Waka-readme stats will appear on the provided repository |
Environment flag | Options (Default , Other , ...) |
Description |
---|---|---|
SHOW_TITLE |
false , true |
Add title to waka-readme stats blob |
SECTION_NAME |
waka , any alphanumeric string |
The generator will look for section name to fill up the readme. |
BLOCKS |
░▒▓█ , ⣀⣄⣤⣦⣶⣷⣿ , -# , => , you can be creative |
Ascii art used to build stats graph |
CODE_LANG |
txt , python ruby json , you can use other languages also |
Language syntax based highlighted text |
TIME_RANGE |
last_7_days , last_30_days , last_6_months , last_year , all_time |
String representing a dispensation from which stats are aggregated |
LANG_COUNT |
5 , any plausible number |
Number of languages to be displayed |
SHOW_TIME |
true , false |
Displays the amount of time spent for each language |
SHOW_TOTAL |
false , true |
Show total coding time |
SHOW_MASKED_TIME |
false , true |
Adds total coding time including unclassified languages (overrides: SHOW_TOTAL ) |
STOP_AT_OTHER |
false , true |
Stop when language marked as Other is retrieved (overrides: LANG_COUNT ) |
Environment flag | Options (Default , Other , ...) |
---|---|
COMMIT_MESSAGE |
Updated waka-readme graph with new metrics , any reasonable message |
TARGET_BRANCH |
NOT_SET , target branch name |
TARGET_PATH |
NOT_SET , /path/to/target/file |
COMMITTER_NAME |
NOT_SET , committer name |
COMMITTER_EMAIL |
NOT_SET , committer email |
AUTHOR_NAME |
NOT_SET , author name |
AUTHOR_EMAIL |
NOT_SET , author email |
All of these flags are optional.
waka-readme.yml
name: Waka Readme
on:
workflow_dispatch:
schedule:
# Runs at 12am UTC
- cron: "0 0 * * *"
jobs:
update-readme:
name: WakaReadme DevMetrics
runs-on: ubuntu-latest
steps:
- uses: athul/waka-readme@master
with:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
# meta
API_BASE_URL: https://wakatime.com/api
REPOSITORY: athul/athul
# content
SHOW_TITLE: true
SECTION_NAME: waka
BLOCKS: ->
CODE_LANG: all_time
TIME_RANGE: true
LANG_COUNT: 10
SHOW_TIME: true
SHOW_TOTAL: true
SHOW_MASKED_TIME: false
STOP_AT_OTHER: true
# commit
COMMIT_MESSAGE: Updated waka-readme graph with new metrics
TARGET_BRANCH: master
TARGET_PATH: README.md
COMMITTER_NAME: GitHubActionBot
COMMITTER_EMAIL: action-bot@github.org
AUTHOR_NAME: Athul
AUTHOR_EMAIL: athul@example.org
# you can populate email-id with secretes instead
Note:
- Flags
REPOSITORY
andGH_TOKEN
are required, ONLY if you're NOT using profile readme.WAKATIME_API_KEY
is a required secret.- Every other environment variables is optional.
- The above example does not show proper default values, refer #Tweaks for the same.
README.md
From: 10 July 2020 - To: 06 August 2022
Total Time: 1,464 hrs 54 mins
Python 859 hrs 29 mins >>>>>>>>>>>>>>----------- 54.68 %
Markdown 132 hrs 33 mins >>----------------------- 08.43 %
TeX 103 hrs 52 mins >>----------------------- 06.61 %
HTML 94 hrs 48 mins >>----------------------- 06.03 %
Nim 64 hrs 31 mins >------------------------ 04.11 %
Other 47 hrs 58 mins >------------------------ 03.05 %
I am a fan of minimal designs and the profile readme is a great way to show off your skills and interests. The WakaTime API, gets us a lot of data about a person's coding activity including the editors and Operating Systems you used and the projects you worked on. Some of these projects maybe secretive and should not be shown out to the public. Using up more data via the Wakatime API will clutter the profile readme and hinder your chances on displaying what you provide value to the community like the pinned Repositories. I believe that Coding Stats is nerdiest of all since you can tell the community that you are exercising these languages or learning a new language, this will also show that you spend some amount of time to learn and exercise your development skills. That's what matters in the end ❤️