DEV Community

Cover image for Adding WakaTime stats to your Github README
Raman Butta
Raman Butta

Posted on • Edited on

Adding WakaTime stats to your Github README

First I referred to this tutorial.

Of particular note is the integration of my local IDE to my Wakatime account. For example I use the Zed editor. So I typed Zed in my "Supported IDEs" in Wakatime website, which led me to this project page. It says to ensure that the .wakatime.cfg is created in the very Home (~) directory of your machine and the wakatime api_key is added to this file. Upon restarting your IDE, you'll see your stats in your Wakatime dashboard.

I added wakatime to Google Colab by running in a code cell like this (not sure if it works):

%%writefile /root/.wakatime.cfg
[settings]
api_key = YOUR_WAKATIME_API_KEY
Enter fullscreen mode Exit fullscreen mode

Now I went to Github.

In the /.github/workflows/waka.yml file I created, I added the following code:

name: Update WakaTime Stats

on:
  schedule:
    - cron: '0 0 * * *' # Runs daily at midnight UTC
  workflow_dispatch: # Allows you to manually trigger the workflow

jobs:
  update-readme:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Update WakaTime Stats in README
        uses: athul/waka-readme@master
        with:
          WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
Enter fullscreen mode Exit fullscreen mode

Note that I added a "Checkout Repository" step as well so that it captures my activity on Github also, not just on my IDE.

Also note that I used the popular Github action of Athul here. Anmol's Github action can also be used here.

Once you run this Github action, your README starts getting populated with stats.

By default, all Wakatime APIs provide your past 7 days' activity.

Follow me on my X Profile

Top comments (0)