From 4d06539136297fad9caacb3a55a5bd3d20e59390 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Fri, 14 Jan 2022 04:49:14 +0100 Subject: [PATCH] docs: updated workflows examples and options descriptions (#772) [skip ci] --- .github/examples.mjs | 44 ++++++ source/app/metrics/metadata.mjs | 57 +++++++- source/plugins/achievements/README.md | 59 ++++++-- source/plugins/achievements/examples.yml | 23 ++++ source/plugins/activity/README.md | 49 +++++-- source/plugins/activity/examples.yml | 10 ++ source/plugins/anilist/README.md | 68 ++++++++-- source/plugins/anilist/examples.yml | 28 ++++ source/plugins/base/README.md | 36 +++-- source/plugins/code/README.md | 45 ++++-- source/plugins/code/examples.yml | 9 ++ source/plugins/contributors/README.md | 77 ++++++++--- source/plugins/contributors/examples.yml | 27 ++++ source/plugins/core/README.md | 53 +++++++- source/plugins/discussions/README.md | 36 ++++- source/plugins/discussions/examples.yml | 8 ++ source/plugins/followup/README.md | 57 ++++++-- source/plugins/followup/examples.yml | 25 ++++ source/plugins/gists/README.md | 31 ++++- source/plugins/gists/examples.yml | 7 + source/plugins/habits/README.md | 58 ++++++-- source/plugins/habits/examples.yml | 21 +++ source/plugins/introduction/README.md | 48 +++++-- source/plugins/introduction/examples.yml | 20 +++ source/plugins/isocalendar/README.md | 44 +++++- source/plugins/isocalendar/examples.yml | 16 +++ source/plugins/languages/README.md | 113 +++++++++++++--- source/plugins/languages/examples.yml | 45 ++++++ source/plugins/licenses/README.md | 59 ++++++-- source/plugins/licenses/examples.yml | 22 +++ source/plugins/lines/README.md | 33 ++++- source/plugins/lines/examples.yml | 7 + source/plugins/music/README.md | 158 +++++++++++++++------- source/plugins/music/examples.yml | 82 +++++++++++ source/plugins/nightscout/README.md | 42 ++++-- source/plugins/nightscout/examples.yml | 6 + source/plugins/notable/README.md | 53 ++++++-- source/plugins/notable/examples.yml | 17 +++ source/plugins/pagespeed/README.md | 61 +++++++-- source/plugins/pagespeed/examples.yml | 26 ++++ source/plugins/people/README.md | 62 +++++++-- source/plugins/people/examples.yml | 21 +++ source/plugins/poopmap/README.md | 31 +++-- source/plugins/poopmap/examples.yml | 5 + source/plugins/posts/README.md | 55 ++++++-- source/plugins/posts/examples.yml | 19 +++ source/plugins/projects/README.md | 39 ++++-- source/plugins/projects/examples.yml | 9 ++ source/plugins/reactions/README.md | 49 +++++-- source/plugins/reactions/examples.yml | 10 ++ source/plugins/repositories/README.md | 34 ++++- source/plugins/repositories/examples.yml | 8 ++ source/plugins/rss/README.md | 28 ++-- source/plugins/rss/tests.yml | 7 +- source/plugins/screenshot/README.md | 44 ++++-- source/plugins/screenshot/examples.yml | 10 ++ source/plugins/skyline/README.md | 43 ++++-- source/plugins/skyline/examples.yml | 9 ++ source/plugins/sponsors/README.md | 46 +++++-- source/plugins/sponsors/examples.yml | 16 +++ source/plugins/stackoverflow/README.md | 46 +++++-- source/plugins/stackoverflow/examples.yml | 10 ++ source/plugins/stargazers/README.md | 31 ++++- source/plugins/stargazers/examples.yml | 7 + source/plugins/starlists/README.md | 44 ++++-- source/plugins/starlists/examples.yml | 9 ++ source/plugins/stars/README.md | 34 ++++- source/plugins/stars/examples.yml | 8 ++ source/plugins/stock/README.md | 42 ++++-- source/plugins/stock/examples.yml | 8 ++ source/plugins/support/README.md | 32 ++++- source/plugins/support/examples.yml | 6 + source/plugins/topics/README.md | 50 +++++-- source/plugins/topics/examples.yml | 18 +++ source/plugins/traffic/README.md | 32 ++++- source/plugins/traffic/examples.yml | 9 ++ source/plugins/tweets/README.md | 52 +++++-- source/plugins/tweets/examples.yml | 23 ++++ source/plugins/wakatime/README.md | 44 ++++-- source/plugins/wakatime/examples.yml | 12 ++ 80 files changed, 2292 insertions(+), 450 deletions(-) create mode 100644 .github/examples.mjs create mode 100644 source/plugins/achievements/examples.yml create mode 100644 source/plugins/activity/examples.yml create mode 100644 source/plugins/anilist/examples.yml create mode 100644 source/plugins/code/examples.yml create mode 100644 source/plugins/contributors/examples.yml create mode 100644 source/plugins/discussions/examples.yml create mode 100644 source/plugins/followup/examples.yml create mode 100644 source/plugins/gists/examples.yml create mode 100644 source/plugins/habits/examples.yml create mode 100644 source/plugins/introduction/examples.yml create mode 100644 source/plugins/isocalendar/examples.yml create mode 100644 source/plugins/languages/examples.yml create mode 100644 source/plugins/licenses/examples.yml create mode 100644 source/plugins/lines/examples.yml create mode 100644 source/plugins/music/examples.yml create mode 100644 source/plugins/nightscout/examples.yml create mode 100644 source/plugins/notable/examples.yml create mode 100644 source/plugins/pagespeed/examples.yml create mode 100644 source/plugins/people/examples.yml create mode 100644 source/plugins/poopmap/examples.yml create mode 100644 source/plugins/posts/examples.yml create mode 100644 source/plugins/projects/examples.yml create mode 100644 source/plugins/reactions/examples.yml create mode 100644 source/plugins/repositories/examples.yml create mode 100644 source/plugins/screenshot/examples.yml create mode 100644 source/plugins/skyline/examples.yml create mode 100644 source/plugins/sponsors/examples.yml create mode 100644 source/plugins/stackoverflow/examples.yml create mode 100644 source/plugins/stargazers/examples.yml create mode 100644 source/plugins/starlists/examples.yml create mode 100644 source/plugins/stars/examples.yml create mode 100644 source/plugins/stock/examples.yml create mode 100644 source/plugins/support/examples.yml create mode 100644 source/plugins/topics/examples.yml create mode 100644 source/plugins/traffic/examples.yml create mode 100644 source/plugins/tweets/examples.yml create mode 100644 source/plugins/wakatime/examples.yml diff --git a/.github/examples.mjs b/.github/examples.mjs new file mode 100644 index 00000000..b81e45ce --- /dev/null +++ b/.github/examples.mjs @@ -0,0 +1,44 @@ +//Imports +import fs from "fs/promises" +import fss from "fs" +import paths from "path" +import url from "url" +import metadata from "../source/app/metrics/metadata.mjs" +import yaml from "js-yaml" + +//Paths +const __metrics = paths.join(paths.dirname(url.fileURLToPath(import.meta.url)), "..") +const __templates = paths.join(paths.join(__metrics, "source/templates/")) +const __plugins = paths.join(paths.join(__metrics, "source/plugins/")) + +//Load plugins metadata +const {plugins, templates} = await metadata({log:false, diff:true}) + +async function plugin(id) { + const path = paths.join(__plugins, id) + const readme = paths.join(path, "README.md") + const examples = paths.join(path, "examples.yml") + return { + readme:{ + path:readme, + content:`${await fs.readFile(readme)}` + }, + examples:fss.existsSync(examples) ? yaml.load(await fs.readFile(examples), "utf8") ?? [] : [], + options:plugins[id].readme.table + } +} + +//Plugins +for (const id of Object.keys(plugins)) { + const {examples, options, readme} = await plugin(id) + //Plugin readme + await fs.writeFile(readme.path, readme.content + .replace(/()[\s\S]*()/g, `$1\n${examples.map(({test, prod, ...step}) => ["```yaml", yaml.dump(step), "```"].join("\n")).join("\n")}\n$2`) + .replace(/()[\s\S]*()/g, `$1\n${options}\n$2`) + ) + //Plugin tests +} + +//Templates + +//Workflow \ No newline at end of file diff --git a/source/app/metrics/metadata.mjs b/source/app/metrics/metadata.mjs index b81d5db6..48c57be0 100644 --- a/source/app/metrics/metadata.mjs +++ b/source/app/metrics/metadata.mjs @@ -3,12 +3,16 @@ import fs from "fs" import yaml from "js-yaml" import path from "path" import url from "url" +import fetch from "node-fetch" //Defined categories const categories = ["core", "github", "social", "community"] +//Previous descriptors +let previous = null + /**Metadata descriptor parser */ -export default async function metadata({log = true} = {}) { +export default async function metadata({log = true, diff = false} = {}) { //Paths const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "../../..") const __templates = path.join(__metrics, "source/templates") @@ -19,6 +23,16 @@ export default async function metadata({log = true} = {}) { //Init const logger = log ? console.debug : () => null + //Diff with latest version + if (diff) { + try { + previous = yaml.load(await fetch("https://raw.githubusercontent.com/lowlighter/metrics/latest/action.yml").then(response => response.text())) + } + catch (error) { + logger(error) + } + } + //Load plugins metadata let Plugins = {} logger("metrics/metadata > loading plugins metadata") @@ -254,8 +268,47 @@ metadata.plugin = async function({__plugins, name, logger}) { const raw = `${await fs.promises.readFile(path.join(__plugins, name, "README.md"), "utf-8")}` const demo = raw.match(/(?[\s\S]*?<[/]table>)/)?.groups?.demo?.replace(/<[/]?(?:table|tr)>/g, "")?.trim() ?? "" + //Options table + const table = [ + "| Option | Type *(format)* **[default]** *{allowed values}* | Description |", + "| ------ | -------------------------------- | ----------- |", + Object.entries(inputs).map(([option, {description, type, ...o}]) => { + let row = [] + { + const cell = [`${"`"}${option}${"`"}`] + if (type === "token") + cell.push("🔐") + if (!Object.keys(previous?.inputs ?? {}).includes(option)) + cell.push("✨") + row.push(cell.join(" ")) + } + { + const cell = [`${"`"}${type}${"`"}`] + if ("format" in o) + cell.push(`*(${o.format})*`) + if ("default" in o) + cell.push(`**[${o.default}]**`) + if ("values" in o) + cell.push(`*{${o.values.map(value => `"${value}"`).join(", ")}}*`) + if ("min" in o) + cell.push(`*{${o.min} ≤`) + if (("min" in o)||("max" in o)) + cell.push(`${"min" in o ? "" : "*{"}đ‘Ĩ${"max" in o ? "" : "}*"}`) + if ("max" in o) + cell.push(`≤ ${o.max}}*`) + row.push(cell.join(" ")) + } + row.push(description) + return `| ${row.join(" | ")} |` + }).join("\n"), + "\n", + "Legend for option icons:", + "* 🔐 Value should be stored in repository secrets", + "* ✨ New feature currently in testing on `master`/`main`" + ].flat(Infinity).filter(s => s).join("\n") + //Readme descriptor - meta.readme = {demo} + meta.readme = {demo, table} } //Icon diff --git a/source/plugins/achievements/README.md b/source/plugins/achievements/README.md index 96fabab6..592f78df 100644 --- a/source/plugins/achievements/README.md +++ b/source/plugins/achievements/README.md @@ -27,19 +27,54 @@ It also lets you quickly see at a glance what this user primarly use GitHub for, ![Ranks](/.github/readme/imgs/plugin_achievements_ranks.png) +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `plugin_achievements` | `boolean` **[no]** | Display achievements | +| `plugin_achievements_threshold` | `string` **[C]** *{"S", "A", "B", "C", "X"}* | Display rank minimal threshold | +| `plugin_achievements_secrets` | `boolean` **[yes]** | Display unlocked secrets achievements | +| `plugin_achievements_display` | `string` **[detailed]** *{"detailed", "compact"}* | Achievements display style | +| `plugin_achievements_limit` | `number` **[0]** *{0 ≤ đ‘Ĩ}* | Maximum number of achievements to display | +| `plugin_achievements_ignored` | `array` *(comma-separated)* **[]** | Unlocked achievements to hide | +| `plugin_achievements_only` | `array` *(comma-separated)* **[]** | Unlocked achievements to display | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) - + ```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - plugin_achievements: yes - plugin_achievements_threshold: B # Display achievements with rank B or higher - plugin_achievements_secrets: yes # Display unlocked secrets achievements - plugin_achievements_display: compact # Use compact display - plugin_achievements_limit: 0 # Display all unlocked achievements (no limit) - plugin_achievements_ignored: octonaut # Hide "octonaut" achievement - plugin_achievements_only: explorer # Display only "explorer" achievement (don't use with "ignored" option) +name: Detailed display +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.achievements.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + plugin_achievements: 'yes' + plugin_achievements_only: sponsor, maintainer, octonaut + ``` +```yaml +name: Compact display +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.achievements.compact.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + plugin_achievements: 'yes' + plugin_achievements_only: >- + polyglot, stargazer, sponsor, deployer, member, maintainer, developer, + scripter, packager, explorer, infographile, manager + plugin_achievements_display: compact + plugin_achievements_threshold: X + +``` + \ No newline at end of file diff --git a/source/plugins/achievements/examples.yml b/source/plugins/achievements/examples.yml new file mode 100644 index 00000000..580ebb57 --- /dev/null +++ b/source/plugins/achievements/examples.yml @@ -0,0 +1,23 @@ +- name: Detailed display + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.achievements.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + plugin_achievements: yes + plugin_achievements_only: sponsor, maintainer, octonaut + test: + timeout: 900000 + +- name: Compact display + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.achievements.compact.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + plugin_achievements: yes + plugin_achievements_only: polyglot, stargazer, sponsor, deployer, member, maintainer, developer, scripter, packager, explorer, infographile, manager + plugin_achievements_display: compact + plugin_achievements_threshold: X + test: + timeout: 900000 \ No newline at end of file diff --git a/source/plugins/activity/README.md b/source/plugins/activity/README.md index ea26ea8e..af1eefea 100644 --- a/source/plugins/activity/README.md +++ b/source/plugins/activity/README.md @@ -29,20 +29,43 @@ It uses data from [GitHub events](https://docs.github.com/en/free-pro-team@lates Use a full `repo` scope token to display **private** events. +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `plugin_activity` | `boolean` **[no]** | Display recent activity | +| `plugin_activity_limit` | `number` **[5]** *{1 ≤ đ‘Ĩ ≤ 1000}* | Maximum number of events to display | +| `plugin_activity_load` | `number` **[300]** *{100 ≤ đ‘Ĩ ≤ 1000}* | Number of events to load | +| `plugin_activity_days` | `number` **[14]** *{0 ≤ đ‘Ĩ ≤ 365}* | Maximum event age | +| `plugin_activity_filter` | `array` *(comma-separated)* **[all]** *{"all", "comment", "ref/create", "ref/delete", "release", "push", "issue", "pr", "review", "wiki", "fork", "star", "member", "public"}* | Events types to keep | +| `plugin_activity_visibility` | `string` **[all]** *{"public", "all"}* | Set events visibility | +| `plugin_activity_timestamps` | `boolean` **[no]** | Display events timestamps | +| `plugin_activity_skipped` | `array` *(comma-separated)* **[]** | Repositories to skip | +| `plugin_activity_ignored` | `undefined` **[github-actions[bot], dependabot[bot], dependabot-preview[bot]]** | Actors to ignore | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) - + ```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - plugin_activity: yes - plugin_activity_limit: 5 # Limit to 5 events - plugin_activity_load: 100 # Load up to 100 recent events from API (should be higher than "limit") - plugin_activity_days: 14 # Keep only events from last 14 days (set to 0 for no limit) - plugin_activity_filter: all # Show all events (use table above to filter events types) - plugin_activity_visibility: public # Only display public events - plugin_activity_timestamps: yes # Display events timestamps - plugin_activity_skipped: repo # Ignored repositories +name: Recent activity +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.activity.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + plugin_activity: 'yes' + plugin_activity_limit: 5 + plugin_activity_days: 0 + plugin_activity_filter: issue, pr, release, fork, review, ref/create + ``` + \ No newline at end of file diff --git a/source/plugins/activity/examples.yml b/source/plugins/activity/examples.yml new file mode 100644 index 00000000..9478dfb5 --- /dev/null +++ b/source/plugins/activity/examples.yml @@ -0,0 +1,10 @@ +- name: Recent activity + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.activity.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + plugin_activity: yes + plugin_activity_limit: 5 + plugin_activity_days: 0 + plugin_activity_filter: issue, pr, release, fork, review, ref/create diff --git a/source/plugins/anilist/README.md b/source/plugins/anilist/README.md index b9b52373..1690a2a6 100644 --- a/source/plugins/anilist/README.md +++ b/source/plugins/anilist/README.md @@ -25,19 +25,63 @@ This plugin is composed of the following sections, which can be displayed or hid These sections can also be filtered by media type, which can be either `anime`, `manga` or both. +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `plugin_anilist` | `boolean` **[no]** | Display data from your AniList account | +| `plugin_anilist_medias` | `array` *(comma-separated)* **[anime, manga]** *{"anime", "manga"}* | Medias types to display | +| `plugin_anilist_sections` | `array` *(comma-separated)* **[favorites]** *{"favorites", "watching", "reading", "characters"}* | Sections to display | +| `plugin_anilist_limit` | `number` **[2]** *{0 ≤ đ‘Ĩ}* | Maximum number of entries to display per section | +| `plugin_anilist_limit_characters` | `number` **[22]** *{0 ≤ đ‘Ĩ}* | Maximum number of entries to display in characters section | +| `plugin_anilist_shuffle` | `boolean` **[yes]** | Shuffle AniList data | +| `plugin_anilist_user` | `string` **[.user.login]** | AniList login | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) - + ```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - plugin_anilist: yes - plugin_anilist_medias: anime, manga # Display both animes and mangas - plugin_anilist_sections: favorites, characters # Display only favorites and characters sections - plugin_anilist_limit: 2 # Limit to 2 entry per section (characters section excluded) - plugin_anilist_limit_characters: 22 # Limit to 22 characters in characters section - plugin_anilist_shuffle: yes # Shuffle data for more varied outputs - plugin_anilist_user: .user.login # Use same username as GitHub login +name: Favorites anime and currently watching +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.anilist.svg + token: NOT_NEEDED + plugin_anilist: 'yes' + plugin_anilist_medias: anime + plugin_anilist_sections: favorites, watching + plugin_anilist_limit: 1 + ``` +```yaml +name: Favorites manga and currently reading +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.anilist.manga.svg + token: NOT_NEEDED + plugin_anilist: 'yes' + plugin_anilist_medias: manga + plugin_anilist_sections: favorites, reading + plugin_anilist_limit: 1 + +``` +```yaml +name: Favorites characters +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.anilist.characters.svg + token: NOT_NEEDED + plugin_anilist: 'yes' + plugin_anilist_sections: characters + plugin_anilist_limit_characters: 22 + +``` + \ No newline at end of file diff --git a/source/plugins/anilist/examples.yml b/source/plugins/anilist/examples.yml new file mode 100644 index 00000000..3f085db7 --- /dev/null +++ b/source/plugins/anilist/examples.yml @@ -0,0 +1,28 @@ +- name: Favorites anime and currently watching + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.anilist.svg + token: NOT_NEEDED + plugin_anilist: yes + plugin_anilist_medias: anime + plugin_anilist_sections: favorites, watching + plugin_anilist_limit: 1 + +- name: Favorites manga and currently reading + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.anilist.manga.svg + token: NOT_NEEDED + plugin_anilist: yes + plugin_anilist_medias: manga + plugin_anilist_sections: favorites, reading + plugin_anilist_limit: 1 + +- name: Favorites characters + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.anilist.characters.svg + token: NOT_NEEDED + plugin_anilist: yes + plugin_anilist_sections: characters + plugin_anilist_limit_characters: 22 diff --git a/source/plugins/base/README.md b/source/plugins/base/README.md index 140fec42..7c1e73e5 100644 --- a/source/plugins/base/README.md +++ b/source/plugins/base/README.md @@ -24,19 +24,29 @@ It contains the following sections: These are all enabled by default, but you can explicitely opt out from them. +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `base` | `array` *(comma-separated)* **[header, activity, community, repositories, metadata]** *{"header", "activity", "community", "repositories", "metadata"}* | Metrics base content | +| `repositories` | `number` **[100]** *{0 ≤ đ‘Ĩ}* | Number of repositories to use | +| `repositories_batch` | `number` **[100]** *{1 ≤ đ‘Ĩ ≤ 100}* | Number of repositories to load at once by queries | +| `repositories_forks` | `boolean` **[no]** | Include forks in metrics | +| `repositories_affiliations` | `array` *(comma-separated)* **[owner]** *{"owner", "collaborator", "organization_member"}* | Repositories affiliations | +| `repositories_skipped` | `array` *(comma-separated)* **[]** | Default repositories to skip | +| `commits_authoring` | `array` *(comma-seperated)* **[.user.login]** | List of surnames or email addresses you use when authoring commits | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) + -```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - base: header, repositories # Only display "header" and "repositories" sections - repositories: 100 # Query only last 100 repositories - repositories_batch: 25 # Query repositories 25 by 25 (lower this to avoid API timeouts) - repositories_forks: no # Don't include forks - repositories_affiliations: owner, collaborator # Display only repositories where user is owner or collaborator - repositories_skipped: lowlighter/lowlighter # Exclude automatically "lowlighter/lowlighter" repository from plugins allowing a skip list - commits_authoring: octocat@github.com # Handle you use when authoring commits, which can be used to filter commits in other plugins -``` + diff --git a/source/plugins/code/README.md b/source/plugins/code/README.md index 48f92777..9ba11d34 100644 --- a/source/plugins/code/README.md +++ b/source/plugins/code/README.md @@ -11,18 +11,39 @@ Display a random code snippet from your recent activity history.
+#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `plugin_code` | `boolean` **[no]** | Display a random code snippet from recent activity | +| `plugin_code_lines` | `number` **[12]** | Maximum number of line that a code snippet can contain | +| `plugin_code_load` | `number` **[100]** *{100 ≤ đ‘Ĩ ≤ 1000}* | Number of events to load | +| `plugin_code_visibility` | `string` **[public]** *{"public", "all"}* | Set events visibility | +| `plugin_code_skipped` | `array` *(comma-separated)* **[]** | Repositories to skip | +| `plugin_code_languages` | `array` *(comma-separated)* **[]** | Restrict code snippet languages | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) - + ```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - plugin_code: yes - plugin_code_lines: 12 # Only display snippets with less than 12 lines - plugin_code_load: 100 # Fetch 100 events from activity - plugin_code_visibility: public # Only display snippets from public activity - plugin_code_skipped: github/octocat # Skip github/octocat repository - plugin_code_languages: javascript # Limit code snippets to JavaScript code -``` \ No newline at end of file +name: JavaScript or TypeScript snippet of the day +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.code.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + plugin_code: 'yes' + plugin_code_languages: javascript, typescript + plugin_code_load: 400 + +``` + \ No newline at end of file diff --git a/source/plugins/code/examples.yml b/source/plugins/code/examples.yml new file mode 100644 index 00000000..b38eff89 --- /dev/null +++ b/source/plugins/code/examples.yml @@ -0,0 +1,9 @@ +- name: JavaScript or TypeScript snippet of the day + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.code.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + plugin_code: yes + plugin_code_languages: javascript, typescript + plugin_code_load: 400 \ No newline at end of file diff --git a/source/plugins/contributors/README.md b/source/plugins/contributors/README.md index 531f80e6..285429ce 100644 --- a/source/plugins/contributors/README.md +++ b/source/plugins/contributors/README.md @@ -34,24 +34,65 @@ plugin_contributors_categories: | Each time a file modified by a contributor match a fileglob, they will be added in said category. Matching is performed in keys order. +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `plugin_contributors` | `boolean` **[no]** | Display repository contributors | +| `plugin_contributors_base` | `string` **[]** | Base reference | +| `plugin_contributors_head` | `string` **[master]** | Head reference | +| `plugin_contributors_ignored` | `array` *(comma-separated)* **[github-actions[bot], dependabot[bot], dependabot-preview[bot]]** | Contributors to ignore | +| `plugin_contributors_contributions` | `boolean` **[no]** | Display contributions | +| `plugin_contributors_sections` | `array` *(comma-separated)* **[contributors]** *{"contributors", "categories"}* | Sections to display | +| `plugin_contributors_categories` | `json` **[{ + "📚 Documentation": ["README.md", "docs/**"], + "đŸ’ģ Code": ["source/**", "src/**"], + "#ī¸âƒŖ Others": ["*"] +} +]** | Contributions categories | + + +Legend for option icons: +* 🔐 Value should be stored in repository secrets +* ✨ New feature currently in testing on `master`/`main` + + +*[→ Full specification](metadata.yml)* + #### â„šī¸ Examples workflows -[âžĄī¸ Available options for this plugin](metadata.yml) - + ```yaml -- uses: lowlighter/metrics@latest - with: - # ... other options - plugin_contributors: yes - plugin_contributors_base: "" # Base reference (commit, tag, branch, etc.) - plugin_contributors_head: main # Head reference (commit, tag, branch, etc.) - plugin_contributors_ignored: bot # Ignore "bot" user - plugin_contributors_contributions: yes # Display number of contributions for each contributor - plugin_contributors_sections: contributors # Display contributors sections - plugin_contributors_categories: | # A JSON mapping of labels by files edited - { - "📚 Documentation": ["README.md", "docs/**"], - "đŸ’ģ Code": ["source/**", "src/**"], - "#ī¸âƒŖ Others": ["*"] - } -``` \ No newline at end of file +name: Contributors with contributions count +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.contributors.contributions.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + template: repository + repo: metrics + plugin_contributors: 'yes' + plugin_contributors_contributions: 'yes' + +``` +```yaml +name: Contributors by categories +uses: lowlighter/metrics@latest +with: + filename: metrics.plugin.contributors.categories.svg + token: ${{ secrets.METRICS_TOKEN }} + base: '' + template: repository + repo: metrics + plugin_contributors: 'yes' + plugin_contributors_sections: categories + plugin_contributors_categories: | + { + "🧩 Plugins / đŸ–ŧī¸ templates":["source/plugins/**", "source/templates/**"], + "📚 Documentation":["README.md", "**/README.md", "**/metadata.yml"], + "đŸ’ģ Code (other)":["source/**", "Dockerfile"] + } + +``` + \ No newline at end of file diff --git a/source/plugins/contributors/examples.yml b/source/plugins/contributors/examples.yml new file mode 100644 index 00000000..22a02b62 --- /dev/null +++ b/source/plugins/contributors/examples.yml @@ -0,0 +1,27 @@ +- name: Contributors with contributions count + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.contributors.contributions.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + template: repository + repo: metrics + plugin_contributors: yes + plugin_contributors_contributions: yes + +- name: Contributors by categories + uses: lowlighter/metrics@latest + with: + filename: metrics.plugin.contributors.categories.svg + token: ${{ secrets.METRICS_TOKEN }} + base: "" + template: repository + repo: metrics + plugin_contributors: yes + plugin_contributors_sections: categories + plugin_contributors_categories: | + { + "🧩 Plugins / đŸ–ŧī¸ templates":["source/plugins/**", "source/templates/**"], + "📚 Documentation":["README.md", "**/README.md", "**/metadata.yml"], + "đŸ’ģ Code (other)":["source/**", "Dockerfile"] + } diff --git a/source/plugins/core/README.md b/source/plugins/core/README.md index e86aa995..2867fdd6 100644 --- a/source/plugins/core/README.md +++ b/source/plugins/core/README.md @@ -2,7 +2,58 @@ Metrics also have general options that impact global metrics rendering. -[âžĄī¸ Available options](metadata.yml) +#### âžĄī¸ Available options + + +| Option | Type *(format)* **[default]** *{allowed values}* | Description | +| ------ | -------------------------------- | ----------- | +| `token` 🔐 | `token` | GitHub Personal Token | +| `user` | `string` **[]** | GitHub username | +| `repo` | `string` **[]** | GitHub repository | +| `committer_token` 🔐 | `token` **[${{ github.token }}]** | GitHub Token used to commit metrics | +| `committer_branch` | `string` **[]** | Branch used to commit rendered metrics | +| `committer_message` | `string` **[Update ${filename} - [Skip GitHub Action]]** | Commit message | +| `committer_gist` | `string` **[]** | Gist used to store metrics | +| `filename` | `string` **[github-metrics.*]** | Rendered metrics output path | +| `markdown` | `string` **[TEMPLATE.md]** | Rendered markdown output path | +| `markdown_cache` | `string` **[.cache]** | Rendered markdown file cache | +| `output_action` | `string` **[commit]** *{"none", "commit", "pull-request", "pull-request-merge", "pull-request-squash", "pull-request-rebase", "gist"}* | Output action | +| `output_condition` | `string` **[always]** *{"always", "data-changed"}* | Output condition | +| `optimize` | `array` *(comma-separated)* **[css, xml]** *{"css", "xml", "svg"}* | SVG optimization | +| `setup_community_templates` | `array` *(comma-separated,/(?[-a-z0-9]+)[/](?[-a-z0-9]+)@(?[-a-z0-9]+):(?