Update README.md
This commit is contained in:
22
README.md
22
README.md
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
Generates your own GitHub metrics as an SVG image to put them on your profile page or elsewhere !
|
Generates your own GitHub metrics as an SVG image to put them on your profile page or elsewhere !
|
||||||
See what it looks like below :
|
See what it looks like below :
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 🦑 Interested to get your own ?
|
### 🦑 Interested to get your own ?
|
||||||
@@ -16,6 +17,7 @@ Try it now at [metrics.lecoq.io](https://metrics.lecoq.io/) with your GitHub use
|
|||||||
Setup a GitHub Action which is run periodically and push a generated SVG image on your repository.
|
Setup a GitHub Action which is run periodically and push a generated SVG image on your repository.
|
||||||
|
|
||||||
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
|
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||

|

|
||||||
```
|
```
|
||||||
@@ -26,9 +28,11 @@ Assuming your username is `my-github-user`, you can embed your metrics in your p
|
|||||||
#### 0. Prepare your personal repository
|
#### 0. Prepare your personal repository
|
||||||
|
|
||||||
If you don't know yet or haven't done it yet, create a repository with the same name as your GitHub username.
|
If you don't know yet or haven't done it yet, create a repository with the same name as your GitHub username.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The `README.md` of this repository will be displayed on your GitHub user profile like below :
|
The `README.md` of this repository will be displayed on your GitHub user profile like below :
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 1. Setup a GitHub token
|
#### 1. Setup a GitHub token
|
||||||
@@ -36,6 +40,7 @@ The `README.md` of this repository will be displayed on your GitHub user profile
|
|||||||
Go to `Developer settings` from your GitHub account settings and select `Personal access tokens` to create a new token.
|
Go to `Developer settings` from your GitHub account settings and select `Personal access tokens` to create a new token.
|
||||||
|
|
||||||
You'll need to create a token with the `public_repo` right so this GitHub Action has enough permissions to push the updated SVG metrics on your personal repository.
|
You'll need to create a token with the `public_repo` right so this GitHub Action has enough permissions to push the updated SVG metrics on your personal repository.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
If you choose to use a bot account, you can put `public_repo` rights to the bot token and invite it as a collaborator on your personal profile repository so it has push access. This way, you can use a personnal token with no rights instead and reduce security issues.
|
If you choose to use a bot account, you can put `public_repo` rights to the bot token and invite it as a collaborator on your personal profile repository so it has push access. This way, you can use a personnal token with no rights instead and reduce security issues.
|
||||||
@@ -43,6 +48,7 @@ If you choose to use a bot account, you can put `public_repo` rights to the bot
|
|||||||
#### 2. Put your GitHub token in your personal repository secrets
|
#### 2. Put your GitHub token in your personal repository secrets
|
||||||
|
|
||||||
Go to the `Settings` of your personal repository to create a new secret and paste your GitHub token here.
|
Go to the `Settings` of your personal repository to create a new secret and paste your GitHub token here.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 3. Create a new GitHub Action workflow on your personal repo
|
#### 3. Create a new GitHub Action workflow on your personal repo
|
||||||
@@ -100,7 +106,6 @@ jobs:
|
|||||||
|
|
||||||
# Enable debug logs
|
# Enable debug logs
|
||||||
debug: no
|
debug: no
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
A new SVG image will be generated and committed to your repository on each run.
|
A new SVG image will be generated and committed to your repository on each run.
|
||||||
@@ -116,6 +121,7 @@ If you don't want to use a bot token, you can use the `plugin_selfskip` which wi
|
|||||||
#### 4. Embed the link into your README.md
|
#### 4. Embed the link into your README.md
|
||||||
|
|
||||||
Edit your README.md on your repository and link it your image :
|
Edit your README.md on your repository and link it your image :
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||

|

|
||||||
```
|
```
|
||||||
@@ -127,6 +133,7 @@ Edit your README.md on your repository and link it your image :
|
|||||||
For conveniency, you can use the shared instance available at [metrics.lecoq.io](https://metrics.lecoq.io) without any additional setup.
|
For conveniency, you can use the shared instance available at [metrics.lecoq.io](https://metrics.lecoq.io) without any additional setup.
|
||||||
|
|
||||||
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
|
Assuming your username is `my-github-user`, you can embed your metrics in your personal repository's readme like below :
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||

|

|
||||||
```
|
```
|
||||||
@@ -165,6 +172,7 @@ You'll need a server where you can install and configure apps.
|
|||||||
|
|
||||||
In your account settings, go to `Developer settings` and select `Personal access tokens` to create a new token.
|
In your account settings, go to `Developer settings` and select `Personal access tokens` to create a new token.
|
||||||
As explained above, you do not need to grant additional permissions to the token unless you want to enable additional plugins.
|
As explained above, you do not need to grant additional permissions to the token unless you want to enable additional plugins.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 2. Install the dependancies
|
#### 2. Install the dependancies
|
||||||
@@ -172,6 +180,7 @@ As explained above, you do not need to grant additional permissions to the token
|
|||||||
Connect to your server and ensure [NodeJS](https://nodejs.org/en/) is installed (see tested versions in the [build workflows](https://github.com/lowlighter/metrics/blob/master/.github/workflows/build.yml)).
|
Connect to your server and ensure [NodeJS](https://nodejs.org/en/) is installed (see tested versions in the [build workflows](https://github.com/lowlighter/metrics/blob/master/.github/workflows/build.yml)).
|
||||||
|
|
||||||
Then run the following commands :
|
Then run the following commands :
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# Clone this repository (or your fork)
|
# Clone this repository (or your fork)
|
||||||
git clone https://github.com/lowlighter/metrics.git
|
git clone https://github.com/lowlighter/metrics.git
|
||||||
@@ -185,6 +194,7 @@ cp settings.example.json settings.json
|
|||||||
#### 3. Configure your instance
|
#### 3. Configure your instance
|
||||||
|
|
||||||
Open and edit `settings.json` to configure your instance using a text editor of your choice.
|
Open and edit `settings.json` to configure your instance using a text editor of your choice.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
//GitHub API token
|
//GitHub API token
|
||||||
@@ -253,6 +263,7 @@ Open and edit `settings.json` to configure your instance using a text editor of
|
|||||||
#### 4. Start your instance
|
#### 4. Start your instance
|
||||||
|
|
||||||
Start your instance once you've finished configuring it :
|
Start your instance once you've finished configuring it :
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
@@ -262,6 +273,7 @@ And you should be able to access it on the port you provided !
|
|||||||
#### 5. Embed the link into your README.md
|
#### 5. Embed the link into your README.md
|
||||||
|
|
||||||
Edit your `README.md` on your repository and include your metrics from your server domain :
|
Edit your `README.md` on your repository and include your metrics from your server domain :
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||

|

|
||||||
```
|
```
|
||||||
@@ -272,11 +284,13 @@ If you want to ensure that your instance will be restarted after reboots or cras
|
|||||||
This is described below for linux-like systems with *systemd*.
|
This is described below for linux-like systems with *systemd*.
|
||||||
|
|
||||||
Create a new service file in `/etc/systemd/system` :
|
Create a new service file in `/etc/systemd/system` :
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
nano /etc/systemd/system/github_metrics.service
|
nano /etc/systemd/system/github_metrics.service
|
||||||
```
|
```
|
||||||
|
|
||||||
Paste the following and edit it with the correct paths :
|
Paste the following and edit it with the correct paths :
|
||||||
|
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=GitHub metrics
|
Description=GitHub metrics
|
||||||
@@ -293,6 +307,7 @@ WantedBy=multi-user.target
|
|||||||
```
|
```
|
||||||
|
|
||||||
Reload services, enable it, start it and check it is up and running :
|
Reload services, enable it, start it and check it is up and running :
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable github_metrics
|
systemctl enable github_metrics
|
||||||
@@ -324,6 +339,7 @@ In return they may require additional configuration and tend to consume addition
|
|||||||
#### ⏱️ PageSpeed
|
#### ⏱️ PageSpeed
|
||||||
|
|
||||||
The *pagespeed* plugin allows you to add the performances of the website attached to the GitHub user account :
|
The *pagespeed* plugin allows you to add the performances of the website attached to the GitHub user account :
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
These are computed through [Google's PageSpeed API](https://developers.google.com/speed/docs/insights/v5/get-started), which returns the same results as [web.dev](https://web.dev).
|
These are computed through [Google's PageSpeed API](https://developers.google.com/speed/docs/insights/v5/get-started), which returns the same results as [web.dev](https://web.dev).
|
||||||
@@ -364,6 +380,7 @@ Add the following to your `settings.json` and pass `?pagespeed=1` in url when ge
|
|||||||
#### 👨💻 Lines
|
#### 👨💻 Lines
|
||||||
|
|
||||||
The *lines* of code plugin allows you to compute the number of lines of code you added and removed across all of your repositories.
|
The *lines* of code plugin allows you to compute the number of lines of code you added and removed across all of your repositories.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -397,6 +414,7 @@ Add the following to your `settings.json` and pass `?lines=1` in url when genera
|
|||||||
#### 🧮 Traffic
|
#### 🧮 Traffic
|
||||||
|
|
||||||
The repositories *traffic* plugin allows you to compute the number of pages views across your repositories.
|
The repositories *traffic* plugin allows you to compute the number of pages views across your repositories.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
@@ -405,6 +423,7 @@ The repositories *traffic* plugin allows you to compute the number of pages view
|
|||||||
It will consume an additional GitHub request per repository.
|
It will consume an additional GitHub request per repository.
|
||||||
|
|
||||||
Because of GitHub REST API limitation, the provided token will require full `repo` permissions to access traffic informations.
|
Because of GitHub REST API limitation, the provided token will require full `repo` permissions to access traffic informations.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
##### Setup with GitHub actions
|
##### Setup with GitHub actions
|
||||||
@@ -435,6 +454,7 @@ Add the following to your `settings.json` and pass `?traffic=1` in url when gene
|
|||||||
#### 💡 Habits
|
#### 💡 Habits
|
||||||
|
|
||||||
The coding *habits* plugin allows you to add deduced coding about based on your recent activity, from up to 100 events.
|
The coding *habits* plugin allows you to add deduced coding about based on your recent activity, from up to 100 events.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
Reference in New Issue
Block a user