Merge branch 'master' of https://github.com/lowlighter/metrics
This commit is contained in:
25
README.md
25
README.md
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
Generate your metrics that you can embed everywhere, including your GitHub profile readme! It works for both user and organization accounts, and even for repositories!
|
Generate your metrics that you can embed everywhere, including your GitHub profile readme! It works for both user and organization accounts, and even for repositories!
|
||||||
|
|
||||||
|
|
||||||
|
<sup>*⚠️ This is the documentation of **v3.5-beta** (`@master` branch) which includes [unreleased features](https://github.com/lowlighter/metrics/compare/latest...master), see documentation of **v3.4** (`@latest` branch) [here](https://github.com/lowlighter/metrics/blob/latest/README.md).*</sup>
|
||||||
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="center">For user accounts</th>
|
<th align="center">For user accounts</th>
|
||||||
@@ -21,6 +25,9 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
And you can customize these heavily with plugins, templates and hundreds of options!
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" align="center">
|
<th colspan="2" align="center">
|
||||||
@@ -222,6 +229,9 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
|||||||
<tr>
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.svg">
|
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.svg">
|
||||||
|
<details><summary>With posts descriptions and cover images version</summary>
|
||||||
|
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.full.svg">
|
||||||
|
</details>
|
||||||
<img width="900" height="1" alt="">
|
<img width="900" height="1" alt="">
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
@@ -236,6 +246,9 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
|||||||
<tr>
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.svg">
|
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.svg">
|
||||||
|
<details><summary>With tweets attachments version</summary>
|
||||||
|
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.attachments.svg">
|
||||||
|
</details>
|
||||||
<img width="900" height="1" alt="">
|
<img width="900" height="1" alt="">
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
@@ -319,7 +332,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics
|
|||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>💬 How to setup?</summary>
|
<summary><b>💬 How to setup?</b> <i>(click to expand)</i></summary>
|
||||||
|
|
||||||
### 0. Setup your personal repository
|
### 0. Setup your personal repository
|
||||||
|
|
||||||
@@ -432,7 +445,7 @@ For convenience, you can use the shared instance available at [metrics.lecoq.io]
|
|||||||
This is mostly intended for previews, to enjoy all features consider using GitHub Action instead.
|
This is mostly intended for previews, to enjoy all features consider using GitHub Action instead.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>💬 Fair use</summary>
|
<summary><b>💬 Fair use</b> <i>(click to expand)</i></summary>
|
||||||
|
|
||||||
To ensure service availability, shared instance has a few limitations:
|
To ensure service availability, shared instance has a few limitations:
|
||||||
* Images are cached for 15 minutes
|
* Images are cached for 15 minutes
|
||||||
@@ -458,7 +471,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics
|
|||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>💬 How to setup?</summary>
|
<summary><b>💬 How to setup?</b> <i>(click to expand)</i></summary>
|
||||||
|
|
||||||
### 0. Prepare your server
|
### 0. Prepare your server
|
||||||
|
|
||||||
@@ -750,7 +763,7 @@ While metrics targets mainly user accounts, it's possible to render metrics for
|
|||||||

|

|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>💬 Metrics for organizations</summary>
|
<summary><b>💬 Metrics for organizations</b> <i>(click to expand)</i></summary>
|
||||||
|
|
||||||
Setup is the same as for user accounts, though you'll need to add `read:org` scope, **whether you're member of target organization or not**.
|
Setup is the same as for user accounts, though you'll need to add `read:org` scope, **whether you're member of target organization or not**.
|
||||||
|
|
||||||
@@ -778,7 +791,7 @@ To support private repositories, add full `repo` scope to your personal token.
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>💬 Organizations memberships for user accounts</summary>
|
<summary><b>💬 Organizations memberships for user accounts</b> <i>(click to expand)</i></summary>
|
||||||
|
|
||||||
Only public memberships can be displayed by metrics by default.
|
Only public memberships can be displayed by metrics by default.
|
||||||
You can manage your membership visibility in the `People` tab of your organization:
|
You can manage your membership visibility in the `People` tab of your organization:
|
||||||
@@ -814,6 +827,8 @@ Copyright (c) 2020 lowlighter
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## 📖 Useful references
|
## 📖 Useful references
|
||||||
|
|
||||||
* [GitHub GraphQL API](https://docs.github.com/en/graphql)
|
* [GitHub GraphQL API](https://docs.github.com/en/graphql)
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ Sections will be ordered the same as specified in `plugin_people_types`.
|
|||||||
plugin_people_limit: 28 # Limit to 28 entries per section
|
plugin_people_limit: 28 # Limit to 28 entries per section
|
||||||
plugin_people_size: 28 # Size in pixels of displayed avatars
|
plugin_people_size: 28 # Size in pixels of displayed avatars
|
||||||
plugin_people_identicons: no # Use avatars (do not use identicons)
|
plugin_people_identicons: no # Use avatars (do not use identicons)
|
||||||
plugin_people_thanks: lowlighter, octocat # Users that will be displayed in "thanks" sections
|
plugin_people_thanks: lowlighter, octocat # Users that will be displayed in "thanks" section
|
||||||
|
plugin_people_sponsors_custom: octocat # Users that will be displayed additionally in "sponsors" section
|
||||||
plugin_people_shuffle: yes # Shuffle for varied output
|
plugin_people_shuffle: yes # Shuffle for varied output
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -21,9 +21,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {limit, types, size, identicons, thanks, shuffle} = imports.metadata.plugins.people.inputs({data, account, q}, {types:context.default})
|
let {limit, types, size, identicons, thanks, shuffle, "sponsors.custom":_sponsors} = imports.metadata.plugins.people.inputs({data, account, q}, {types:context.default})
|
||||||
//Filter types
|
//Filter types
|
||||||
types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])]
|
types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])]
|
||||||
|
if ((types.includes("sponsorshipsAsMaintainer"))&&(_sponsors?.length)) {
|
||||||
|
types.unshift("sponsorshipsCustom")
|
||||||
|
data.user.sponsorshipsAsMaintainer.totalCount += _sponsors.length
|
||||||
|
}
|
||||||
|
|
||||||
//Retrieve followers from graphql api
|
//Retrieve followers from graphql api
|
||||||
console.debug(`metrics/compute/${login}/plugins > people > querying api`)
|
console.debug(`metrics/compute/${login}/plugins > people > querying api`)
|
||||||
@@ -37,9 +41,10 @@
|
|||||||
const {data:nodes} = await rest.repos.listContributors({owner, repo})
|
const {data:nodes} = await rest.repos.listContributors({owner, repo})
|
||||||
result[type].push(...nodes.map(({login, avatar_url}) => ({login, avatarUrl:avatar_url})))
|
result[type].push(...nodes.map(({login, avatar_url}) => ({login, avatarUrl:avatar_url})))
|
||||||
}
|
}
|
||||||
else if (type === "thanks") {
|
else if ((type === "thanks")||(type === "sponsorshipsCustom")) {
|
||||||
const nodes = await Promise.all(thanks.map(async username => (await rest.users.getByUsername({username})).data))
|
const users = {thanks, sponsorshipsCustom:_sponsors}[type] ?? []
|
||||||
result[type].push(...nodes.map(({login, avatar_url}) => ({login, avatarUrl:avatar_url})))
|
const nodes = await Promise.all(users.map(async username => (await rest.users.getByUsername({username})).data))
|
||||||
|
result[{sponsorshipsCustom:"sponsorshipsAsMaintainer"}[type] ?? type].push(...nodes.map(({login, avatar_url}) => ({login, avatarUrl:avatar_url})))
|
||||||
}
|
}
|
||||||
//GraphQL
|
//GraphQL
|
||||||
else {
|
else {
|
||||||
@@ -77,6 +82,10 @@
|
|||||||
await Promise.all(result[type].map(async user => user.avatar = await imports.imgb64(user.avatarUrl)))
|
await Promise.all(result[type].map(async user => user.avatar = await imports.imgb64(user.avatarUrl)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Special type handling
|
||||||
|
if (types.includes("sponsorshipsCustom"))
|
||||||
|
types.splice(types.indexOf("sponsorshipsCustom"), 1)
|
||||||
|
|
||||||
//Results
|
//Results
|
||||||
return {types, size, ...result}
|
return {types, size, ...result}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,14 @@ inputs:
|
|||||||
format: comma-separated
|
format: comma-separated
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
|
# Add specified users to GitHub sponsors ("sponsors" must be specified in "plugin_people_types")
|
||||||
|
# This is useful to list sponsors from unsupported GitHub sponsors sources
|
||||||
|
plugin_people_sponsors_custom:
|
||||||
|
description: Custom GitHub sponsors
|
||||||
|
type: array
|
||||||
|
format: comma-separated
|
||||||
|
default: ""
|
||||||
|
|
||||||
# Use GitHub identicons instead of users' avatar (for privacy purposes)
|
# Use GitHub identicons instead of users' avatar (for privacy purposes)
|
||||||
plugin_people_identicons:
|
plugin_people_identicons:
|
||||||
description: Use identicons instead of avatars
|
description: Use identicons instead of avatars
|
||||||
|
|||||||
@@ -32,6 +32,14 @@
|
|||||||
plugin_people: yes
|
plugin_people: yes
|
||||||
plugin_people_types: sponsors
|
plugin_people_types: sponsors
|
||||||
|
|
||||||
|
- name: People plugin (custom sponsors)
|
||||||
|
uses: lowlighter/metrics@latest
|
||||||
|
with:
|
||||||
|
token: MOCKED_TOKEN
|
||||||
|
plugin_people: yes
|
||||||
|
plugin_people_types: sponsors
|
||||||
|
plugin_people_sponsors_custom: lowlighter, octocat
|
||||||
|
|
||||||
- name: People plugin (stargazers)
|
- name: People plugin (stargazers)
|
||||||
uses: lowlighter/metrics@latest
|
uses: lowlighter/metrics@latest
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user