Skip to content

Commit a3e45eb

Browse files
committed
feat: flags to tweak commit info; bump version
- flags are now available to modify commit information - adds these flags to `dockerfile` & `action.yml` - fixes a few typos - improves `Readme.md` - updates secondary dependencies - bumps project version **Related Items** _Issues_ - Closes #103 - Closes #104 - Closes #125
1 parent 7d29cf1 commit a3e45eb

File tree

6 files changed

+259
-114
lines changed

6 files changed

+259
-114
lines changed

README.md

Lines changed: 69 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Alternatively, you can also fetch data from WakaTime compatible services like [W
2828

2929
## Prep Work
3030

31-
A GitHub repository and a `README.md` file is required. We'll be making use of readme in the [profile repository][profile_readme]\*.
31+
A GitHub repository and a `README.md` file is required. We'll be making use of readme in the [profile repository][profile_readme].
3232

3333
- Save the `README.md` file after copy-pasting the following special comments. Your dev-metics will show up in between.
3434

@@ -48,7 +48,7 @@ A GitHub repository and a `README.md` file is required. We'll be making use of r
4848
- If you're not using [profile repository][profile_readme], add another secret _named_ `GH_TOKEN` and insert your [GitHub token][gh_access_token]\* in place of _value_.
4949

5050
- 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.
51-
- Clear any existing contents, add the following lines and save the file.
51+
- Clear any existing contents, add the following lines and save the `waka-readme.yml` workflow file.
5252

5353
```yml
5454
name: Waka Readme
@@ -72,25 +72,47 @@ A GitHub repository and a `README.md` file is required. We'll be making use of r
7272
#REPOSITORY: <gh_username/gh_username>
7373
```
7474

75+
Refer [#Example](#example) section for a full blown workflow file.
76+
7577
## Tweaks
7678

77-
There are many flags that you can tweak to suit your taste!
78-
79-
| Flag | Default | Options | Meaning |
80-
| ------------------ | -------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
81-
| `API_BASE_URL` | `https://wakatime.com/api` | `https://wakatime.com/api`, `https://wakapi.dev/api`, `https://hakatime.mtx-dev.xyz/api` | Integration with WakaTime compatible services like [Wakapi][wakapi] & [Hakatime][hakatime] are possible |
82-
| `REPOSITORY` | `<gh_username>/<gh_username>` | `<gh_username>/<repo_name>` | Waka-readme stats will appear on the provided repository |
83-
| `SECTION_NAME` | `waka` | Any alphanumeric string | The generator will look for this section to fill up the readme. |
84-
| `COMMIT_MESSAGE` | `Updated waka-readme graph with new metrics` | Any string | Messaged used when committing updated stats |
85-
| `CODE_LANG` | `txt` | `python` `ruby` `json` , you can use other languages also | Language syntax to format the generated text, to get colored text. |
86-
| `SHOW_TITLE` | `false` | `false`, `true` | Add title to waka-readme stats blob |
87-
| `BLOCKS` | `░▒▓█` | `░▒▓█`, `⣀⣄⣤⣦⣶⣷⣿`, `-#`, you can be creative! | Ascii art used to build stats graph |
88-
| `TIME_RANGE` | `last_7_days` | `last_7_days`, `last_30_days`, `last_6_months`, `last_year`, `all_time` | String representing a dispensation from which stats are aggregated |
89-
| `SHOW_TIME` | `true` | `false`, `true` | Displays the amount of time spent for each language |
90-
| `SHOW_TOTAL` | `false` | `false`, `true` | Show total coding time |
91-
| `SHOW_MASKED_TIME` | `false` | `false`, `true` | Adds total coding time including unclassified languages (overrides: `SHOW_TOTAL`) |
92-
| `LANG_COUNT` | `5` | Any reasonable number | Number of languages to be displayed |
93-
| `STOP_AT_OTHER` | `false` | `false`, `true` | Stop when language marked as `Other` is retrieved (overrides: `LANG_COUNT`) |
79+
There are many flags that you can tweak as you wish!
80+
81+
### Meta Tweaks
82+
83+
| Environment flag | Options (`Default`, `Other`, ...) | Description |
84+
| ---------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
85+
| `API_BASE_URL` | `https://wakatime.com/api`, `https://wakapi.dev/api`, `https://hakatime.mtx-dev.xyz/api` | Use WakaTime compatible services like [Wakapi][wakapi] & [Hakatime][hakatime] |
86+
| `REPOSITORY` | `<gh_username>/<gh_username>`, `<gh_username>/<repo_name>` | Waka-readme stats will appear on the provided repository |
87+
88+
### Content Tweaks
89+
90+
| Environment flag | Options (`Default`, `Other`, ...) | Description |
91+
| ------------------ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
92+
| `SHOW_TITLE` | `false`, `true` | Add title to waka-readme stats blob |
93+
| `SECTION_NAME` | `waka`, any alphanumeric string | The generator will look for section name to fill up the readme. |
94+
| `BLOCKS` | `░▒▓█`, `⣀⣄⣤⣦⣶⣷⣿`, `-#`, `=>`, you can be creative | Ascii art used to build stats graph |
95+
| `CODE_LANG` | `txt`, `python` `ruby` `json` , you can use other languages also | Language syntax based highlighted text |
96+
| `TIME_RANGE` | `last_7_days`, `last_30_days`, `last_6_months`, `last_year`, `all_time` | String representing a dispensation from which stats are aggregated |
97+
| `LANG_COUNT` | `5`, any plausible number | Number of languages to be displayed |
98+
| `SHOW_TIME` | `true`, `false` | Displays the amount of time spent for each language |
99+
| `SHOW_TOTAL` | `false`, `true` | Show total coding time |
100+
| `SHOW_MASKED_TIME` | `false`, `true` | Adds total coding time including unclassified languages (overrides: `SHOW_TOTAL`) |
101+
| `STOP_AT_OTHER` | `false`, `true` | Stop when language marked as `Other` is retrieved (overrides: `LANG_COUNT`) |
102+
103+
### Commit Tweaks
104+
105+
| Environment flag | Options (`Default`, `Other`, ...) |
106+
| ----------------- | -------------------------------------------------------------------- |
107+
| `COMMIT_MESSAGE` | `Updated waka-readme graph with new metrics`, any reasonable message |
108+
| `TARGET_BRANCH` | `NOT_SET`, target branch name |
109+
| `TARGET_PATH` | `NOT_SET`, `/path/to/target/file` |
110+
| `COMMITTER_NAME` | `NOT_SET`, committer name |
111+
| `COMMITTER_EMAIL` | `NOT_SET`, committer email |
112+
| `AUTHOR_NAME` | `NOT_SET`, author name |
113+
| `AUTHOR_EMAIL` | `NOT_SET`, author email |
114+
115+
All of these flags are _optional_.
94116

95117
# Example
96118

@@ -112,15 +134,40 @@ jobs:
112134
steps:
113135
- uses: athul/waka-readme@master
114136
with:
137+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
115138
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
139+
# meta
140+
API_BASE_URL: https://wakatime.com/api
141+
REPOSITORY: athul/athul
142+
# content
116143
SHOW_TITLE: true
144+
SECTION_NAME: waka
117145
BLOCKS: ->
118-
TIME_RANGE: all_time
119-
SHOW_TIME: true
120-
SHOW_MASKED_TIME: true
146+
CODE_LANG: all_time
147+
TIME_RANGE: true
121148
LANG_COUNT: 10
149+
SHOW_TIME: true
150+
SHOW_TOTAL: true
151+
SHOW_MASKED_TIME: false
152+
STOP_AT_OTHER: true
153+
# commit
154+
COMMIT_MESSAGE: Updated waka-readme graph with new metrics
155+
TARGET_BRANCH: master
156+
TARGET_PATH: README.md
157+
COMMITTER_NAME: GitHubActionBot
158+
COMMITTER_EMAIL: action-bot@github.org
159+
AUTHOR_NAME: Athul
160+
AUTHOR_EMAIL: athul@example.org
161+
# you can populate email-id with secretes instead
122162
```
123163

164+
> Note:
165+
>
166+
> - Flags `REPOSITORY` and `GH_TOKEN` are required, ONLY if you're NOT using [profile readme][profile_readme].
167+
> - `WAKATIME_API_KEY` is a required secret.
168+
> - Every other environment variables is optional.
169+
> - The above example does not show proper default values, refer [#Tweaks](#tweaks) for the same.
170+
124171
**`README.md`**
125172

126173
```md
@@ -140,10 +187,6 @@ Other 47 hrs 58 mins >------------------------ 03.05 %
140187

141188
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 :heart:
142189

143-
---
144-
145-
<sup>\*</sup>`REPOSITORY` flag and `GH_TOKEN` secret are required you're not using profile readme.
146-
147190
[//]: #(Links)
148191
[wakapi]: https://wakapi.dev
149192
[hakatime]: https://github.com/mujx/hakatime

action.yml

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,98 @@
11
name: "Waka - Readme"
2-
author: Athul Cyriac Ajay
3-
description: "Add a Wakatime Coding Activity graph in your Readme"
2+
author: "Athul Cyriac Ajay"
3+
description: "WakaTime coding activity graph in your profile readme"
44

55
inputs:
66
GH_TOKEN:
77
description: "GitHub access token with Repo scope"
88
default: ${{ github.token }}
99
required: true
10-
1110
WAKATIME_API_KEY:
1211
description: "Your Wakatime/Wakapi/Hakatime API Key"
1312
required: true
1413

14+
# meta tweaks
1515
API_BASE_URL:
1616
description: "Alternative API base URL when using a third-party WakaTime-ish backend"
1717
default: "https://wakatime.com/api"
1818
required: false
19-
2019
REPOSITORY:
2120
description: "Your GitHub repository"
2221
default: ${{ github.repository }}
2322
required: false
2423

25-
COMMIT_MESSAGE:
26-
description: "Add a commit message of your choice"
27-
default: "Updated waka-readme graph with new metrics"
28-
required: false
29-
3024
# content tweaks
31-
3225
SHOW_TITLE:
3326
description: "Displays the week number and days in Readme as title"
3427
default: "false"
3528
required: false
36-
3729
SECTION_NAME:
3830
description: "Section name for data to appear in readme"
3931
required: false
4032
default: "waka"
41-
4233
BLOCKS:
4334
description: "Add the progress blocks of your choice"
4435
default: "░▒▓█"
4536
required: false
46-
4737
CODE_LANG:
4838
description: "Add syntax formatter for generated code"
4939
default: "txt"
5040
required: false
51-
5241
TIME_RANGE:
5342
description: "Time range of the queried statistics"
5443
default: "last_7_days"
5544
required: false
56-
5745
LANG_COUNT:
5846
description: "Maximum number of languages to be shown"
5947
default: "5"
6048
required: false
61-
6249
SHOW_TIME:
6350
description: "Displays the amount of time spent for each language"
6451
default: "true"
6552
required: false
66-
6753
SHOW_TOTAL:
6854
description: "Displays total coding time"
6955
default: "false"
7056
required: false
71-
7257
SHOW_MASKED_TIME:
7358
description: "Displays total coding time including unclassified languages"
7459
default: "false"
7560
required: false
76-
7761
STOP_AT_OTHER:
7862
description: "Stop data retrieval when language marked 'Other' is reached"
7963
default: "false"
8064
required: false
8165

66+
# commit tweaks
67+
COMMIT_MESSAGE:
68+
description: "Add a commit message of your choice"
69+
default: "Updated waka-readme graph with new metrics"
70+
required: false
71+
TARGET_BRANCH:
72+
description: "Target branch"
73+
default: "NOT_SET"
74+
required: false
75+
TARGET_PATH:
76+
description: "Target file path"
77+
default: "NOT_SET"
78+
required: false
79+
COMMITTER_NAME:
80+
description: "Committer name"
81+
default: "NOT_SET"
82+
required: false
83+
COMMITTER_EMAIL:
84+
description: "Committer email"
85+
default: "NOT_SET"
86+
required: false
87+
AUTHOR_NAME:
88+
description: "Author name"
89+
default: "NOT_SET"
90+
required: false
91+
AUTHOR_EMAIL:
92+
description: "Author email"
93+
default: "NOT_SET"
94+
required: false
95+
8296
runs:
8397
using: "docker"
8498
image: "dockerfile"

dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,29 @@ FROM docker.io/python:3-slim
22

33
ENV INPUT_GH_TOKEN \
44
INPUT_WAKATIME_API_KEY \
5+
# meta
56
INPUT_API_BASE_URL \
67
INPUT_REPOSITORY \
7-
INPUT_COMMIT_MESSAGE \
8+
# content
89
INPUT_SHOW_TITLE \
910
INPUT_SECTION_NAME \
1011
INPUT_BLOCKS \
12+
INPUT_CODE_LANG \
13+
INPUT_TIME_RANGE \
14+
INPUT_LANG_COUNT \
1115
INPUT_SHOW_TIME \
1216
INPUT_SHOW_TOTAL \
13-
INPUT_TIME_RANGE \
1417
INPUT_SHOW_MASKED_TIME \
15-
INPUT_LANG_COUNT \
16-
INPUT_STOP_AT_OTHER
18+
INPUT_STOP_AT_OTHER \
19+
# commit
20+
INPUT_COMMIT_MESSAGE \
21+
INPUT_TARGET_BRANCH \
22+
INPUT_TARGET_PATH \
23+
INPUT_COMMITTER_NAME \
24+
INPUT_COMMITTER_EMAIL \
25+
INPUT_AUTHOR_NAME \
26+
INPUT_AUTHOR_EMAIL
27+
1728

1829
ENV PATH="${PATH}:/root/.local/bin" \
1930
# python

0 commit comments

Comments
 (0)