Add new plugin habits

This commit is contained in:
lowlighter
2020-10-13 23:00:05 +02:00
parent e9e23d6028
commit 7ff3a7f46b
16 changed files with 221 additions and 25 deletions

View File

@@ -106,6 +106,9 @@ jobs:
# The provided GitHub token will require "repo" permissions
plugin_traffic: no
# Enable or disable coding habits metrics
plugin_habits: no
# Enable debug logs
debug: no
@@ -273,6 +276,17 @@ Open and edit `settings.json` to configure your instance.
//When enabled, pass "?traffic=1" in url to compute total page views in your repositories in last two weeks
//Note that this requires that the passed GitHub API token requires a push access
"enabled":true
},
//Habits plugin
"habits":{
//Enable or disable this plugin
//When enabled, pass "?habits=1" in url to generate coding habits based on your recent activity
//This includes stuff like if you're using tabs or space and the time of the day when you push the most
//Note that this requires that the passed GitHub API token requires a push access
"enabled":true,
//Specify the number of events used to compute coding habits. Capped at 100 by GitHub API
//Defaults to 50
"from":50,
}
}
}
@@ -485,6 +499,44 @@ And pass `?traffic=1` in url when generating metrics.
</details>
#### 💡 Habits
The *habits* plugin allows you to add deduced coding about based on your recent activity.
![Habits plugin](https://github.com/lowlighter/metrics/blob/master/.github/readme/imgs/plugin_habits.png)
<details>
<summary>💬 About</summary>
It will consume an additional GitHub request per event fetched.
##### Setup with GitHub actions
Add the following to your workflow :
```yaml
- uses: lowlighter/metrics@latest
with:
# ... other options
plugin_habits: yes
```
##### Setup in your own instance
Add the following to your `settings.json`
```json
"plugins":{
"habits":{
"enabled":true
}
}
```
And pass `?habits=1` in url when generating metrics.
</details>
### 🗂️ Project structure
* `index.mjs` contains the entry points and the settings instance