diff --git a/README.md b/README.md index 89b9ea4d..fe20da28 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Generate metrics that can be embedded everywhere, including your GitHub profile -

🧩 Customizable with 40 plugins and 282 options!

+

🧩 Customizable with 40 plugins and 285 options!

@@ -362,6 +362,8 @@ Generate metrics that can be embedded everywhere, including your GitHub profile # 📚 Documentation +> *⚠️ This is the documentation of **v3.28-beta** (`@master`/`@main` branches) which includes [unreleased features](https://github.com/lowlighter/metrics/compare/latest...master) planned for next release. See documentation for current released version [**v3.27** (`@latest` branch) here](https://github.com/lowlighter/metrics/blob/latest/README.md).* + ## 🦮 Setup diff --git a/action.yml b/action.yml index 50f6066d..808d23cf 100644 --- a/action.yml +++ b/action.yml @@ -439,6 +439,10 @@ inputs: description: Events to use default: + plugin_habits_skipped: + description: Skipped repositories + default: + plugin_habits_days: description: Event maximum age default: @@ -656,6 +660,10 @@ inputs: description: Featured repositories display order default: + plugin_repositories_forks: + description: Include repositories forks + default: + plugin_repositories_affiliations: description: Repositories affiliations default: @@ -783,6 +791,10 @@ inputs: description: Contribution types filter default: + plugin_notable_self: + description: Include own repositories + default: + # ==================================================================================== # 📰 Recent activity diff --git a/source/app/metrics/index.mjs b/source/app/metrics/index.mjs index a66df761..c4aba299 100644 --- a/source/app/metrics/index.mjs +++ b/source/app/metrics/index.mjs @@ -141,10 +141,10 @@ export default async function metrics({login, q}, {graphql, rest, plugins, conf, q = Object.fromEntries([...Object.entries(q).map(([key, value]) => [key.replace(/^plugin_/, "").replace(/_/g, "."), value]), ["base", false]]) //Check users errors const warnings = [] - if ((!Object.keys(Plugins).filter(key => q[key]).length)&&(!parts.length)) - warnings.push({warning:{message:"No plugin were selected"}}) + if ((!Object.keys(Plugins).filter(key => q[key]).length) && (!parts.length)) + warnings.push({warning: {message: "No plugin were selected"}}) const ineffective = Object.keys(q).filter(key => (key.includes(".")) && (key.split(".").at(0) !== "base") && (key.split(".").at(0) in Plugins)).filter(key => !q[key.split(".").at(0)]) - warnings.push(...ineffective.map(key => ({warning:{message:`"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}}))) + warnings.push(...ineffective.map(key => ({warning: {message: `"${key}" has no effect because "${key.split(".").at(0)}: true" is not set`}}))) //Compute rendering const {rendered} = await metrics({login, q}, {...arguments[1], convert: ["svg", "png", "jpeg"].includes(q["config.output"]) ? q["config.output"] : null, warnings}, arguments[2]) console.debug(`metrics/compute/${login}/embed > ${name} > success >>>>>>>>>>>>>>>>>>>>>>`) diff --git a/source/app/metrics/metadata.mjs b/source/app/metrics/metadata.mjs index bf8815e7..771e7064 100644 --- a/source/app/metrics/metadata.mjs +++ b/source/app/metrics/metadata.mjs @@ -220,9 +220,9 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) { //Enable state handler { meta.enabled = function(enabled, {extras = {}, error = true} = {}) { - if ((process.env.GITHUB_ACTIONS)&&(!enabled)) + if ((process.env.GITHUB_ACTIONS) && (!enabled)) console.warn(`::warning::Plugin "${name}" is currently disabled. Add "plugin_${name}: yes" to your workflow to enable it.`) - if ((error)&&(!enabled)) + if ((error) && (!enabled)) throw Object.assign(new Error(`Plugin "${name}" is disabled${process.env.GITHUB_ACTIONS ? "" : " on this server"}`), {enabled: true}) return (enabled) && (meta.extras("enabled", {extras, error})) } diff --git a/source/app/metrics/utils.mjs b/source/app/metrics/utils.mjs index ca5426cd..14f08e30 100644 --- a/source/app/metrics/utils.mjs +++ b/source/app/metrics/utils.mjs @@ -131,7 +131,7 @@ export function formatters({timeZone} = {}) { format.error = function(error, {descriptions = {}, ...attributes} = {}) { try { //Extras features or enable state error - if ((error.extras)||(error.enabled)) + if ((error.extras) || (error.enabled)) throw {error: {message: error.message, instance: error}} //Already formatted error if (error.error?.message) diff --git a/source/app/web/instance.mjs b/source/app/web/instance.mjs index 5d715895..87a975ea 100644 --- a/source/app/web/instance.mjs +++ b/source/app/web/instance.mjs @@ -180,9 +180,9 @@ export default async function({sandbox = false} = {}) { const custom = uapi(session) if (custom) { try { - const {data: {resources}} = await custom.rest.rateLimit.get() - if (resources) - return res.status(200).json({rest: resources.core, graphql: resources.graphql, search: resources.search, login: custom.login}) + const {data: {resources}} = await custom.rest.rateLimit.get() + if (resources) + return res.status(200).json({rest: resources.core, graphql: resources.graphql, search: resources.search, login: custom.login}) } catch (error) { if (error.status === 401) { diff --git a/source/plugins/community/README.md b/source/plugins/community/README.md index aa40d6e1..bd975e31 100644 --- a/source/plugins/community/README.md +++ b/source/plugins/community/README.md @@ -245,7 +245,7 @@ export default async function( //Plugin execution try { //Check if plugin is enabled and requirements are met - if ((!enabled)||(!q.my_plugin)) + if ((!q.my_plugin)||(imports.metadata.plugins.my_plugin.enabled(enabled, {extras}))) return null //Automatically validate user inputs diff --git a/source/plugins/habits/README.md b/source/plugins/habits/README.md index 38e8c616..bdad4cf8 100644 --- a/source/plugins/habits/README.md +++ b/source/plugins/habits/README.md @@ -57,6 +57,18 @@ All product and company names are trademarks™ or registered® trademarks of th ≤ 1000)
default: 200
+ + +

plugin_habits_skipped

+

Skipped repositories

+ + + + ⏩ Inherits repositories_skipped
+✨ On master/main
+type: array +(comma-separated) +

plugin_habits_days

diff --git a/source/plugins/notable/README.md b/source/plugins/notable/README.md index 17300544..ae53ed8e 100644 --- a/source/plugins/notable/README.md +++ b/source/plugins/notable/README.md @@ -127,6 +127,17 @@ Some repositories may not be able to reported advanced stats and in the case the default: commit
allowed values:
  • commit
  • pull_request
  • issue
+ +

plugin_notable_self

+

Include own repositories

+ + + + ✨ On master/main
+type: boolean +
+default: no
+ diff --git a/source/plugins/repositories/README.md b/source/plugins/repositories/README.md index 7e5ffc47..c1da0f6d 100644 --- a/source/plugins/repositories/README.md +++ b/source/plugins/repositories/README.md @@ -110,6 +110,17 @@ All product and company names are trademarks™ or registered® trademarks of th
default: featured, pinned, starred, random
allowed values:
  • featured
  • pinned
  • starred
  • random
+ + +

plugin_repositories_forks

+

Include repositories forks

+ + + + ✨ On master/main
+type: boolean +
+default: no

plugin_repositories_affiliations