Skip to content

Commit c0f4cf4

Browse files
committed
docs: improve overall documentation
1 parent ee1abad commit c0f4cf4

File tree

21 files changed

+162
-236
lines changed

21 files changed

+162
-236
lines changed

.github/readme/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
[![Build, test, analyze and publish](https://github.com/lowlighter/metrics/actions/workflows/workflow.yml/badge.svg)](https://github.com/lowlighter/metrics/actions/workflows/workflow.yml) [![Metrics (examples)](https://github.com/lowlighter/lowlighter/actions/workflows/metrics.yml/badge.svg)](https://github.com/lowlighter/lowlighter/actions/workflows/metrics.yml)
44

5-
<% for (const partial of ["introduction", "features", "setup", "documentation", "license", "references"]) { -%>
5+
<% for (const partial of ["introduction", "documentation", "license"]) { -%>
66
<%- await include(`/partials/${partial}.md`) %>
77
<% } %>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 📚 Documentation
22

3-
<% for (const partial of ["compatibility", "templates", "plugins", "organizations", "contributing"]) { %>
3+
<% if (/[.]0-beta$/.test(packaged.version)) { %>
4+
> <sup>*⚠️ This is the documentation of **v<%= packaged.version.replace(/[.]0-beta$/, "") %>-beta** (`@master`/`@main` branches) which includes [unreleased features](https://github.com/lowlighter/metrics/compare/latest...master). See documentation for [**v<%= (Number(packaged.version.replace(/[.]0-beta$/, ""))-0.01).toFixed(2).replace(/[.]0/, ".") %>** (`@latest` branch) here](https://github.com/lowlighter/metrics/blob/latest/README.md).*</sup>
5+
<% } %>
6+
7+
<% for (const partial of ["setup", "templates", "plugins", "contributing"]) { %>
48
<%- await include(`/partials/documentation/${partial}.md`) -%>
59
<% } %>
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
## 💪 Customizing and contributing
1+
## 💪 Contributing
22

3-
Metrics is built to be easily customizable.
4-
Fork this repository, switch used action from `lowlighter/metrics@latest` to your fork and start coding!
3+
If you are interested in contributing, the following resources may interest you:
54

6-
See [ARCHITECTURE.md](/ARCHITECTURE.md) for more informations about how code is structured.
5+
* [💪 Contribution guide](/CONTRIBUTING.md)
6+
* [🧬 Architecture](/ARCHITECTURE.md)
7+
* [📜 License](/LICENSE)
8+
* **:octocat: GitHub resources**
9+
* [📖 GitHub GraphQL API](https://docs.github.com/en/graphql)
10+
* [📖 GitHub GraphQL Explorer](https://docs.github.com/en/free-pro-team@latest/graphql/overview/explorer)
11+
* [📖 GitHub Rest API](https://docs.github.com/en/rest)
12+
* [📖 GitHub Octicons](https://github.com/primer/octicons)
713

8-
To report a bug fill an [issue](https://github.com/lowlighter/metrics/issues) describing it.
9-
To suggest new features or requesting help to setup metrics, check out [discussions](https://github.com/lowlighter/metrics/discussions).
10-
11-
If you want to contribute, submit a [pull request](https://github.com/lowlighter/metrics/pulls).
12-
Be sure to read [CONTRIBUTING.md](/CONTRIBUTING.md) for more information about this.
14+
Use [`💬 discussions`](https://github.com/lowlighter/metrics/discussions) for feedback, new features suggestions, bugs reports or to request help for installation.

.github/readme/partials/references.md renamed to .github/readme/partials/documentation/inspirations.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
## 📖 Useful references
2-
3-
* [GitHub GraphQL API](https://docs.github.com/en/graphql)
4-
* [GitHub GraphQL Explorer](https://docs.github.com/en/free-pro-team@latest/graphql/overview/explorer)
5-
* [GitHub Rest API](https://docs.github.com/en/rest)
6-
* [GitHub Octicons](https://github.com/primer/octicons)
7-
* See [GitHub Logos and Usage](https://github.com/logos) for more information.
8-
9-
### ✨ Inspirations
1+
# ✨ Inspirations
102

113
* [anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats)
124
* [jstrieb/github-stats](https://github.com/jstrieb/github-stats)

.github/readme/partials/documentation/organizations.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
1-
### 🏦 Organizations metrics
1+
# 🏦 Organizations metrics
22

33
While metrics targets mainly user accounts, it's possible to render metrics for organization accounts.
44

55
![Metrics (organization account)](https://github.com/lowlighter/lowlighter/blob/master/metrics.organization.svg)
66

7-
<details>
8-
<summary><b>💬 Metrics for organizations</b> <i>(click to expand)</i></summary>
7+
## 💬 Metrics for organizations
98

10-
<%- await include(`/partials/documentation/organizations/setup.md`) -%>
9+
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**.
1110

12-
</details>
11+
![Add read:org scope to personal token](/.github/readme/imgs/setup_token_org_read_scope.png)
1312

14-
<details>
15-
<summary><b>💬 Organizations memberships for user accounts</b> <i>(click to expand)</i></summary>
13+
You'll also need to set `user` option with your organization name.
1614

17-
<%- await include(`/partials/documentation/organizations/memberships.md`) -%>
15+
If you're encounting errors and your organization is using single sign-on, try to [authorize your personal token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on).
16+
17+
Most of plugins supported by user accounts will work with organization accounts, but note that rendering metrics for organizations consume way more APIs requests.
18+
19+
To support private repositories, add full `repo` scope to your personal token.
20+
21+
### ℹ️ Example workflow
22+
23+
```yaml
24+
- uses: lowlighter/metrics@latest
25+
with:
26+
# ... other options
27+
token: ${{ secrets.METRICS_TOKEN }} # A personal token from an user account with read:org scope
28+
user: organization-name # Organization name
29+
```
30+
31+
### 💬 Organizations memberships for user accounts
32+
33+
Only public memberships can be displayed by metrics by default.
34+
You can manage your membership visibility in the `People` tab of your organization:
35+
36+
![Publish organization membership](/.github/readme/imgs/setup_public_membership_org.png)
37+
38+
For organization memberships, add `read:org` scope to your personal token.
39+
40+
![Add read:org scope to personal token](/.github/readme/imgs/setup_token_org_read_scope.png)
1841

19-
</details>

.github/readme/partials/documentation/organizations/memberships.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/readme/partials/documentation/organizations/setup.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
## 🧩 Plugins
22

3-
Plugins are features which provide additional content and lets you customize your rendered metrics.
4-
See their respective documentation for more informations about how to setup them.
3+
Plugins provide additional content and lets you customize your rendered metrics.
54

6-
The following plugins are maintained by Metric's core team:
5+
* **📦 Maintained by core team**
76
<% { let previous = null; for (const [plugin, {name, category, authors = []}] of Object.entries(plugins).filter(([key, value]) => (value)&&(value.category !== "community")).sort(([an, a], [bn, b]) => a.category === b.category ? an.localeCompare(bn) : 0)) { %>
87
<% if (previous !== category) { previous = category -%>
9-
* **<%= `${category.charAt(0).toLocaleUpperCase()}${category.substring(1)}` %>**
8+
* **<%= `${category.charAt(0).toLocaleUpperCase()}${category.substring(1)}` %>**
109
<% } -%>
11-
* [<%- name %>](/source/plugins/<%= plugin %>/README.md)<%# -%>
10+
* [<%- name %>](/source/plugins/<%= plugin %>/README.md)<%# -%>
1211
<% }} %>
13-
14-
### 🎲 Community plugins
15-
16-
The following plugins are provided and maintained by Metrics's user community:
12+
* **🎲 Maintained by community**
1713
<% { let previous = null; for (const [plugin, {name, category, authors = []}] of Object.entries(plugins).filter(([key, value]) => (value)&&(value.category === "community")).sort(([an, a], [bn, b]) => a.category === b.category ? an.localeCompare(bn) : 0)) { %><%# -%>
1814
* [<%- name %>](/source/plugins/<%= plugin %>/README.md) by <%- authors.map(author => `[@${author}](https://github.com/${author})`).join(" ") %>
1915
<% }} %>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## 🦮 Setup
2+
3+
There are several ways to setup metrics, each having its advantages and disadvantages:
4+
5+
* [⚙️ Using GitHub Action on a profile repository *(~10 min)*](/.github/readme/partials/setup/action.md)
6+
* ✔️ All features
7+
* ✔️ High availability (no downtimes)
8+
* ➖ Configuration can be a bit time-consuming
9+
* [💕 Using the shared instance *(~1 min)*](/.github/readme/partials/setup/shared.md)
10+
* ✔️ Easily configurable and previewable
11+
* ➖ Limited features *(compute-intensive features are disabled)*
12+
* 🐳 Using command line with docker *(~5 min)* *(documentation not available yet)*
13+
* ✔️ Suited for one-time rendering
14+
* [🏗️ Deploying your own web instance *(~20 min)*](/.github/readme/partials/setup/web.md)
15+
* ➖ Mostly intended for development, or to create another shared instance
16+
17+
Additional resources for setup:
18+
* [🏦 Configuring metrics for organizations](/.github/readme/partials/organizations.md)
19+
* [🧰 Template/Plugin compatibility matrix](/.github/readme/partials/compatibility.md)

.github/readme/partials/setup/action/setup.md renamed to .github/readme/partials/documentation/setup/action.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
<!-- <% if (false) { %> -->
2-
#### 💬 How to setup?
3-
<!-- <% } %> -->
1+
# ⚙️ Using GitHub Action on a profile repository (~10 min setup)
42

5-
### 0. Setup your personal repository
3+
Setup a GitHub Action which runs periodically and pushes generated images to a repository.
4+
5+
Assuming your username is `my-github-user`, you can then embed rendered metrics in your readme like below:
6+
7+
```markdown
8+
<!-- If you're using "master" as default branch -->
9+
![Metrics](https://github.com/my-github-user/my-github-user/blob/master/github-metrics.svg)
10+
<!-- If you're using "main" as default branch -->
11+
![Metrics](https://github.com/my-github-user/my-github-user/blob/main/github-metrics.svg)
12+
```
13+
14+
## 💬 How to setup?
15+
16+
### 0. Setup a personal repository
617

718
Create a repository with the same name as your GitHub login (if it's not already done).
819

0 commit comments

Comments
 (0)