← Back to plugins index | |
This plugin can display which languages you use across all repositories you contributed to. | |
This plugin is not affiliated, associated, authorized, endorsed by, or in any way officially connected with GitHub. All product and company names are trademarks™ or registered® trademarks of their respective holders. | |
Supported features → Full specification |
📗 Classic template 📘 Repository template 📙 Terminal template |
👤 Users 👥 Organizations 📓 Repositories |
|
🔑 (scopeless) read:org (optional) read:user (optional) read:packages (optional) repo (optional) |
|
Option | Description |
Enable languages plugin |
|
type: boolean
default: no |
|
Ignored languages |
|
type: array
(comma-separated)
|
|
Skipped repositories |
|
⏩ Inherits repositories_skipped type: array
(newline-separated)
|
|
Display limit |
|
type: number
(0 ≤
𝑥
≤ 8)
zero behaviour: disable default: 8 |
|
Display threshold (percentage) |
|
type: string
default: 0% |
|
Group unknown, ignored and over-limit languages into "Other" category If this option is enabled, "Other" category will not be subject to |
|
type: boolean
default: no |
|
Custom languages colors |
|
type: array
(comma-separated)
default: github |
|
Custom languages names |
|
type: string
|
|
Displayed sections Note that |
|
type: array
(comma-separated)
default: most-used allowed values:
|
|
Additional details Note that |
|
type: array
(comma-separated)
allowed values:
|
|
Indepth mode
|
|
🌐 Web instances must configure settings.json :
boolean
default: false |
|
Indepth mode - Custom repositories Specify a list of additional repositories to analyze. Below are the supported syntax formats:
It is possible to specify repositories that are not hosted on github.com by passing a full url instead. In this case the repository must be accessible directly.
|
|
type: array
(comma-separated)
|
|
Indepth mode - Analysis timeout |
|
type: number
(1 ≤
𝑥
≤ 60)
default: 15 |
|
Indepth mode - Analysis timeout (repositories) |
|
type: number
(0 ≤
𝑥
≤ 15)
zero behaviour: disable default: 7.5 |
|
Indepth mode - Displayed categories (most-used section) |
|
type: array
(comma-separated)
default: markup, programming allowed values:
|
|
Indepth mode - Displayed categories (recently-used section) |
|
type: array
(comma-separated)
default: markup, programming allowed values:
|
|
Indepth mode - Events to load (recently-used section) |
|
type: number
(100 ≤
𝑥
≤ 1000)
default: 300 |
|
Indepth mode - Events maximum age (day, recently-used section) |
|
type: number
(0 ≤
𝑥
≤ 365)
zero behaviour: disable default: 14 |
The default algorithm uses the top languages from each repository you contributed to using GitHub GraphQL API (which is similar to the displayed languages bar on github.com). When working in collaborative projects with a lot of people, these numbers may be less representative of your actual work.
The plugin_languages_indepth
option lets you use a more advanced algorithm for more accurate statistics.
Under the hood, it will clone your repositories, run linguist-js (a JavaScript port of GitHub linguist) and iterate over patches matching your commits_authoring
setting.
Since git lets you use any email and username for commits, metrics may not be able to detect a commit ownership if it isn't the same as your GitHub personal data. By default, it will use your GitHub username, but you can configure additional matching usernames and email addresses using commits_authoring
option.
Example: configuring indepth
mode
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_indepth: yes
commits_authoring: firstname lastname, username, username@users.noreply.github.com
💡 This feature unlocks the
lines
option inplugin_languages_details
⚠️ This feature significantly increase workflow time
⚠️ Since this mode iterates over each matching commit of each repository, it is not suited for large code base, especially those with a large amount of commits and the ones containing binaries. Whileplugin_languages_analysis_timeout
andplugin_languages_analysis_timeout_repositories
can be used to increase the default timeout for analysis, please be responsible and keep this feature disabled if it cannot work on your account to save GitHub resources and our planet 🌏
⚠️ Although metrics does not send any code to external sources, repositories are temporarily cloned on the GitHub Action runner. It is advised to keep this option disabled when working with sensitive data or company code. Use at your own risk, metrics and its authors cannot be held responsible for any resulting code leaks. Source code is available for auditing at analyzers.mjs.
🌐 Web instances must enable this feature in
settings.json
Below is a summary of the process used to compute indepth statistics:
- Fetch GPG keys linked to your GitHub account
- automatically add attached emails to
commits_authoring
- web-flow (GitHub's public key for changes made through web-ui) is also fetched
- Import GPG keys so they can be used to verify commits later
- Iterate through repositories
- early break if
plugin_languages_analysis_timeout
is reached - skip repository if it matches
plugin_languages_skipped
- include repositories from
plugin_languages_indepth_custom
- a specific branch and commit range can be used
- a source other than github.com can be used
- Clone repository
- target branch is checkout
- List of authored commits is computed
- using
git log --author
andcommits_authoring
to search in commit headers - using
git log --grep
andcommits_authoring
to search in commit body - ensure these are within the range specified by
plugin_languages_indepth_custom
(if applicable)
- Process authored commits
- early break if
plugin_languages_analysis_timeout_repositories
is reached - using
git verify-commit
to check authenticity against imported GPG keys - using
git log --patch
to extract added/deleted lines/bytes from each file - using GitHub linguist (linguist-js) to detect language for each file
- respect
plugin_languages_categories
option - if a file has since been deleted or moved, checkout on the last commit file was present and run linguist again
- respect
- Aggregate results
- Fetch push events linked to your account (or target repository)
- matching
plugin_languages_recent_load
andplugin_languages_recent_days
options - matching committer emails from
commits_authoring
- Process authored commits
- using GitHub linguist (linguist-js) to detect language for each file
- respect
plugin_languages_recent_categories
option - directly pass file content rather than performing I/O and simulating a git repository
- respect
- Aggregate results
This feature uses a similar algorithm as indepth
mode, but uses patches from your events feed instead.
It will fetch a specified amount of recent push events and perform linguistic analysis on it.
⚠️ Note that metrics won't be able to use more events than GitHub API is able to provide
Example: display recently used languages from 400 GitHub events from last 2 weeks
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_sections: recently-used
plugin_languages_recent_load: 400
plugin_languages_recent_days: 14
🌐 Web instances must enable this feature in
settings.json
Several options lets you customize which languages should be displayed. It is possible to ignore completely languages or those lower than a given threshold, skip repositories, and filter by language categories.
Example: hide HTML and CSS languages, skip lowlighter/metrics repository
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_ignored: html, css
plugin_languages_skipped: lowlighter/metrics
Example: hide languages with less than 2% usage
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_threshold: 2%
💡 The threshold feature will automatically scale remaining languages so the total percentage is always 100%. However, other stats like bytes count and lines are not affected.
When using indepth
mode, it is possible to hide languages per category.
Supported categories are data
, markup
, programming
and prose
.
Example: hide data and prose languages from stats
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_categories: data, prose
plugin_languages_recent_categories: data, prose
The plugin uses GitHub language colors, but it may be hard to distinguish them depending on which languages you use.
It is possible to use custom colors using plugin_languages_colors
option.
The following syntaxes are supported:
- A predefined set from colorsets.json (support limited to 8 languages max)
${language}:${color}
to change the color of a language (case insensitive)${n}:${color}
to change the color of the n-th language
Both hexadecimal and named color are supported.
Example: using a predefined color set
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_colors: rainbow
plugin_languages_limit: 8
Example: setting JavaScript to red, the first language to blue and the second one to #ff00aa
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_colors: javascript:red, 0:blue, 1:#ff00aa
This plugin is limited by GitHub linguist capabilities, meaning that some languages may be mislabeled in some cases.
To mitigate this, it is possible to use plugin_languages_aliases
option and provide a list of overrides using the following syntax: ${language}:${alias}
(case insensitive).
Example: display JavaScript as JS and TypeScript as TS
- uses: lowlighter/metrics@latest
with:
plugin_languages: yes
plugin_languages_aliases: javascript:JS typescript:TS
name: Most used
uses: lowlighter/metrics@latest
with:
filename: metrics.plugin.languages.svg
token: ${{ secrets.METRICS_TOKEN }}
base: ""
plugin_languages: yes
plugin_languages_ignored: >-
html, css, tex, less, dockerfile, makefile, qmake, lex, cmake, shell,
gnuplot
plugin_languages_limit: 4
name: Most used (with details)
uses: lowlighter/metrics@latest
with:
filename: metrics.plugin.languages.details.svg
token: ${{ secrets.METRICS_TOKEN }}
base: ""
plugin_languages: yes
plugin_languages_ignored: >-
html, css, tex, less, dockerfile, makefile, qmake, lex, cmake, shell,
gnuplot
plugin_languages_details: bytes-size, percentage
plugin_languages_limit: 4
name: Recently used
uses: lowlighter/metrics@latest
with:
filename: metrics.plugin.languages.recent.svg
token: ${{ secrets.METRICS_TOKEN }}
base: ""
plugin_languages: yes
plugin_languages_ignored: >-
html, css, tex, less, dockerfile, makefile, qmake, lex, cmake, shell,
gnuplot
plugin_languages_sections: recently-used
plugin_languages_details: bytes-size, percentage
plugin_languages_limit: 4
name: Indepth analysis
uses: lowlighter/metrics@latest
with:
filename: metrics.plugin.languages.indepth.svg
token: ${{ secrets.METRICS_TOKEN }}
base: ""
plugin_languages: yes
plugin_languages_ignored: >-
html, css, tex, less, dockerfile, makefile, qmake, lex, cmake, shell,
gnuplot
plugin_languages_indepth: yes
plugin_languages_details: lines, bytes-size
plugin_languages_limit: 4
plugin_languages_analysis_timeout: 15