Rename pagespeed plugin and handle music token correctly
This commit is contained in:
@@ -8,7 +8,7 @@ Generates your own GitHub metrics as an SVG image to put them on your profile pa
|
|||||||
|
|
||||||
But there's more with [plugins](https://github.com/lowlighter/metrics/tree/master/src/plugins) and [templates](https://github.com/lowlighter/metrics/tree/master/src/templates) !
|
But there's more with [plugins](https://github.com/lowlighter/metrics/tree/master/src/plugins) and [templates](https://github.com/lowlighter/metrics/tree/master/src/templates) !
|
||||||
|
|
||||||
| PageSpeed plugin | Music plugin | Languages plugin |
|
| PageSpeed plugin | Music plugin | Languages plugin |
|
||||||
| :-------------------: | :-------------------: | :-------------------: |
|
| :-------------------: | :-------------------: | :-------------------: |
|
||||||
|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.pagespeed.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.pagespeed.svg)|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.music.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.music.svg)|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.languages.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.languages.svg)|
|
|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.pagespeed.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.pagespeed.svg)|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.music.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.music.svg)|[<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.languages.svg" alt="" width="240">](https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.languages.svg)|
|
||||||
| **Follow-up plugin** | **Habits plugin** | **Other plugins** |
|
| **Follow-up plugin** | **Habits plugin** | **Other plugins** |
|
||||||
@@ -68,7 +68,7 @@ Go to the `Settings` of your personal repository to create a new secret and past
|
|||||||
|
|
||||||
#### 3. Create a new GitHub Action workflow on your personal repo
|
#### 3. Create a new GitHub Action workflow on your personal repo
|
||||||
|
|
||||||
Create a new workflow from the `Actions` tab of your personal repository and paste the following :
|
Create a new workflow from the `Actions` tab of your personal repository and paste the following :
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: GitHub metrics as SVG image
|
name: GitHub metrics as SVG image
|
||||||
@@ -275,7 +275,7 @@ Plugins are disabled by default, but you can pass `?<plugin>=1` to enable a spec
|
|||||||
For example, to enable `music` plugin, pass `?music=1` to url.
|
For example, to enable `music` plugin, pass `?music=1` to url.
|
||||||
|
|
||||||
Plugin options can be passed with `?<plugin>.<option>=<value>`.
|
Plugin options can be passed with `?<plugin>.<option>=<value>`.
|
||||||
For example, to configure `music` plugin, you could add the following to url : `?music=1&music.provider=spotify&music.mode=recent&music.limit=4`.
|
For example, to configure `music` plugin, you could add the following to url : `?music=1&music.provider=spotify&music.mode=recent&music.limit=4`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ Add the following to your workflow :
|
|||||||
with:
|
with:
|
||||||
# ... other options
|
# ... other options
|
||||||
plugin_pagespeed: yes
|
plugin_pagespeed: yes
|
||||||
pagespeed_token: ${{ secrets.PAGESPEED_TOKEN }}
|
plugin_pagespeed_token: ${{ secrets.PAGESPEED_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ inputs:
|
|||||||
|
|
||||||
# When PageSpeed plugin is enabled, it is advised to generate a token to avoid the rate-limiter
|
# When PageSpeed plugin is enabled, it is advised to generate a token to avoid the rate-limiter
|
||||||
# See https://developers.google.com/speed/docs/insights/v5/get-started for more informations
|
# See https://developers.google.com/speed/docs/insights/v5/get-started for more informations
|
||||||
pagespeed_token:
|
plugin_pagespeed_token:
|
||||||
description: Google Pagespeed Personal Token
|
description: Google Pagespeed Personal Token
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
|||||||
22
action/dist/index.js
vendored
22
action/dist/index.js
vendored
@@ -335,13 +335,13 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_axios_index_default = /
|
|||||||
//Mode
|
//Mode
|
||||||
if (!(mode in modes))
|
if (!(mode in modes))
|
||||||
throw {error:{message:`Unsupported mode "${mode}"`}, ...raw}
|
throw {error:{message:`Unsupported mode "${mode}"`}, ...raw}
|
||||||
//Playlist mode
|
//Playlist mode
|
||||||
if (mode === "playlist") {
|
if (mode === "playlist") {
|
||||||
if (!playlist)
|
if (!playlist)
|
||||||
throw {error:{message:`Missing playlist url`}, ...raw}
|
throw {error:{message:`Missing playlist url`}, ...raw}
|
||||||
if (!providers[provider].embed.test(playlist))
|
if (!providers[provider].embed.test(playlist))
|
||||||
throw {error:{message:`Unsupported playlist url format`}, ...raw}
|
throw {error:{message:`Unsupported playlist url format`}, ...raw}
|
||||||
}
|
}
|
||||||
//Limit
|
//Limit
|
||||||
limit = Math.max(1, Math.min(100, Number(limit)))
|
limit = Math.max(1, Math.min(100, Number(limit)))
|
||||||
|
|
||||||
@@ -880,18 +880,19 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_actions_github_lib_gith
|
|||||||
//Additional plugins options
|
//Additional plugins options
|
||||||
//Pagespeed
|
//Pagespeed
|
||||||
if (plugins.pagespeed.enabled) {
|
if (plugins.pagespeed.enabled) {
|
||||||
plugins.pagespeed.token = core.getInput("pagespeed_token")
|
plugins.pagespeed.token = core.getInput("plugin_pagespeed_token")
|
||||||
console.log(`Pagespeed token | ${plugins.pagespeed.token ? "provided" : "missing"}`)
|
console.log(`Pagespeed token | ${plugins.pagespeed.token ? "provided" : "missing"}`)
|
||||||
}
|
}
|
||||||
//Music
|
//Music
|
||||||
if (plugins.music.enabled) {
|
if (plugins.music.enabled) {
|
||||||
for (const option of ["provider", "token", "mode", "playlist", "limit"])
|
for (const option of ["provider", "mode", "playlist", "limit"])
|
||||||
q[`music.${option}`] = core.getInput(`plugin_music_${option}`) || ""
|
q[`music.${option}`] = core.getInput(`plugin_music_${option}`) || ""
|
||||||
console.log(`Music provider | ${q["music.provider"]}`)
|
console.log(`Music provider | ${q["music.provider"]}`)
|
||||||
console.log(`Music token | ${q["music.token"] ? "provided" : "missing"}`)
|
|
||||||
console.log(`Music plugin mode | ${q["music.mode"]}`)
|
console.log(`Music plugin mode | ${q["music.mode"]}`)
|
||||||
console.log(`Music playlist | ${q["music.playlist"]}`)
|
console.log(`Music playlist | ${q["music.playlist"]}`)
|
||||||
console.log(`Music tracks limit | ${q["music.limit"]}`)
|
console.log(`Music tracks limit | ${q["music.limit"]}`)
|
||||||
|
plugins.music.token = core.getInput("plugin_music_token") || ""
|
||||||
|
console.log(`Music token | ${plugins.music.token ? "provided" : "missing"}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Repositories to use
|
//Repositories to use
|
||||||
@@ -904,7 +905,6 @@ var E_Users_lecoq_Documents_GitHub_gitstats_node_modules_actions_github_lib_gith
|
|||||||
|
|
||||||
//Built query
|
//Built query
|
||||||
q = {...q, ...base, repositories, template}
|
q = {...q, ...base, repositories, template}
|
||||||
console.debug(JSON.stringify(q))
|
|
||||||
|
|
||||||
//Render metrics
|
//Render metrics
|
||||||
const rendered = await metrics({login:user, q}, {graphql, rest, plugins, conf, die})
|
const rendered = await metrics({login:user, q}, {graphql, rest, plugins, conf, die})
|
||||||
|
|||||||
@@ -86,18 +86,19 @@
|
|||||||
//Additional plugins options
|
//Additional plugins options
|
||||||
//Pagespeed
|
//Pagespeed
|
||||||
if (plugins.pagespeed.enabled) {
|
if (plugins.pagespeed.enabled) {
|
||||||
plugins.pagespeed.token = core.getInput("pagespeed_token")
|
plugins.pagespeed.token = core.getInput("plugin_pagespeed_token")
|
||||||
console.log(`Pagespeed token | ${plugins.pagespeed.token ? "provided" : "missing"}`)
|
console.log(`Pagespeed token | ${plugins.pagespeed.token ? "provided" : "missing"}`)
|
||||||
}
|
}
|
||||||
//Music
|
//Music
|
||||||
if (plugins.music.enabled) {
|
if (plugins.music.enabled) {
|
||||||
for (const option of ["provider", "token", "mode", "playlist", "limit"])
|
for (const option of ["provider", "mode", "playlist", "limit"])
|
||||||
q[`music.${option}`] = core.getInput(`plugin_music_${option}`) || ""
|
q[`music.${option}`] = core.getInput(`plugin_music_${option}`) || ""
|
||||||
console.log(`Music provider | ${q["music.provider"]}`)
|
console.log(`Music provider | ${q["music.provider"]}`)
|
||||||
console.log(`Music token | ${q["music.token"] ? "provided" : "missing"}`)
|
|
||||||
console.log(`Music plugin mode | ${q["music.mode"]}`)
|
console.log(`Music plugin mode | ${q["music.mode"]}`)
|
||||||
console.log(`Music playlist | ${q["music.playlist"]}`)
|
console.log(`Music playlist | ${q["music.playlist"]}`)
|
||||||
console.log(`Music tracks limit | ${q["music.limit"]}`)
|
console.log(`Music tracks limit | ${q["music.limit"]}`)
|
||||||
|
plugins.music.token = core.getInput("plugin_music_token") || ""
|
||||||
|
console.log(`Music token | ${plugins.music.token ? "provided" : "missing"}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Repositories to use
|
//Repositories to use
|
||||||
@@ -110,7 +111,6 @@
|
|||||||
|
|
||||||
//Built query
|
//Built query
|
||||||
q = {...q, ...base, repositories, template}
|
q = {...q, ...base, repositories, template}
|
||||||
console.debug(JSON.stringify(q))
|
|
||||||
|
|
||||||
//Render metrics
|
//Render metrics
|
||||||
const rendered = await metrics({login:user, q}, {graphql, rest, plugins, conf, die})
|
const rendered = await metrics({login:user, q}, {graphql, rest, plugins, conf, die})
|
||||||
|
|||||||
@@ -48,13 +48,13 @@
|
|||||||
//Mode
|
//Mode
|
||||||
if (!(mode in modes))
|
if (!(mode in modes))
|
||||||
throw {error:{message:`Unsupported mode "${mode}"`}, ...raw}
|
throw {error:{message:`Unsupported mode "${mode}"`}, ...raw}
|
||||||
//Playlist mode
|
//Playlist mode
|
||||||
if (mode === "playlist") {
|
if (mode === "playlist") {
|
||||||
if (!playlist)
|
if (!playlist)
|
||||||
throw {error:{message:`Missing playlist url`}, ...raw}
|
throw {error:{message:`Missing playlist url`}, ...raw}
|
||||||
if (!providers[provider].embed.test(playlist))
|
if (!providers[provider].embed.test(playlist))
|
||||||
throw {error:{message:`Unsupported playlist url format`}, ...raw}
|
throw {error:{message:`Unsupported playlist url format`}, ...raw}
|
||||||
}
|
}
|
||||||
//Limit
|
//Limit
|
||||||
limit = Math.max(1, Math.min(100, Number(limit)))
|
limit = Math.max(1, Math.min(100, Number(limit)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user