Log your daily WakaTime coding activity to a secret Gist.
The script allows you to backup/export/log your daily WakaTime coding activity (durations) every day, so that you don't lose any day's data. To automate the process of running the script every day, one can make use of cron jobs offered by CIs - in this case, GitHub Actions.
You can either run this script daily, locally, or let Travis handle it for you. To ensure no sensitive data is included in the git repository, environment variables are used for configuration. There are many ways to set these up.
You must first create a secret Gist that shall serve as the log file. Don't worry about naming the files, or the content - WakaLogger will take care of that. Make sure to take note of the Gist ID: it can be found in the URL.
If the GIST_ID
variable is not found/undefined, WakaLogger will create a secret Gist for you and tell you the ID. Note it and define the environment variable.
Note: Even though the following instructions will work, this repository now uses GitHub Actions to perform the cronjobs.
The .travis.yml
file contains the required commands that Travis will execute each time it builds the repository.
-
Fork your own copy of this repository
-
Set up Travis on your forked repository by going to https://travis-ci.org
-
Once set, go to the Travis repository settings
-
Set the following environment variables:
GITHUB_USERNAME GITHUB_PASSWORD GIST_ID WAKATIME_USERNAME WAKATIME_API_KEY
-
Create a cron job (in the repo settings itself): "Branch" shall be
master
, and the ideal frequency should either be "daily" or "weekly"
-
Clone this repo:
git clone https://github.com/plibither8/wakalogger
-
Install packages:
npm install
-
Define environment variables in your
.bashrc
/.zshrc
/etc. file:export GITHUB_USERNAME= # Your GitHub username export GITHUB_PASSWORD= # Your GitHub password in plaintext export GIST_ID= # ID of the secret Gist export WAKATIME_USERNAME= # Your WakaTime username export WAKATIME_API_KEY= # Your WakaTime API key
The WakaTime API key can be found here: https://wakatime.com/settings/api-key.
-
Run the script:
node index