Files
metrics/action.yml
github-actions[bot] c36588e444 Auto-regenerate files
2021-02-19 00:03:14 +00:00

818 lines
26 KiB
YAML

# ====================================================================================
# Inputs and configuration
inputs:
# ====================================================================================
# 🗃️ Base content
# Base content
base:
description: Metrics base content
default: header, activity, community, repositories, metadata
# Number of repositories to use to computes metrics
# Using more will result in more accurate metrics, but you may hit GitHub rate-limit more easily if you use a lot of plugins
repositories:
description: Number of repositories to use
default: 100
# Include forked repositories into metrics
repositories_forks:
description: Include forks in metrics
default: no
# Filter repositories by user affiliations
# Note that it may affect some plugin outputs (broad affiliations will result in less representative metrics)
repositories_affiliations:
description: Repositories affiliations
default: owner
# ====================================================================================
# 🧱 Core
# User account personal token
# No additional scopes are needed unless you want to include private repositories metrics
# Some plugins may also require additional scopes
# ────────────────────────────────────────────────────────────────
# If you're only using plugins which don't really require a GitHub token, you may pass "NOT_NEEDED" as value
token:
description: GitHub Personal Token
required: true
# GitHub username
user:
description: GitHub username
default: ""
# Set to "${{ secrets.GITHUB_TOKEN }}"
committer_token:
description: GitHub Token used to commit metrics
default: ""
# Branch used to commit rendered metrics
committer_branch:
description: Branch used to commit rendered metrics
default: ""
# Rendered metrics output path, relative to repository's root
filename:
description: Rendered metrics output path
default: github-metrics.svg
# Optimize SVG image to reduce its filesize
# Some templates may not support this option
optimize:
description: SVG optimization
default: yes
# Setup additional templates from remote repositories
setup_community_templates:
description: Additional community templates to setup
default: ""
# Template to use
# To use community template, prefix its name with "@"
template:
description: Template to use
default: classic
# Additional query parameters (JSON string)
# Some templates may require additional parameters which you can specify here
# Do not use this option to pass plugins parameters as they'll be overwritten by the other options
query:
description: Additional query parameters
default: "{}"
# Timezone used by metrics
# See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
config_timezone:
description: Timezone used
default: ""
# Specify in which order metrics content will be displayed
# If you omit some partials, they'll be appended at the end in default order
# See "partials/_.json" of each template for a list of supported partials
config_order:
description: Configure content order
default: ""
# Use twemojis instead of emojis
# May increase filesize but emojis will be rendered the same across all platforms
config_twemoji:
description: Use twemojis instead of emojis
default: no
# Enable SVG CSS animations
config_animations:
description: SVG CSS animations
default: yes
# Configure padding for output image (percentage value)
# It can be used to add padding to generated metrics if rendering is cropped or has too much empty space
# Specify one value (for both width and height) or two values (one for width and one for height)
config_padding:
description: Image padding
default: 6%, 15%
# Metrics output format
config_output:
description: Output image format
default: svg
# Throw on plugins errors
# If disabled, metrics will handle errors gracefully with a message in rendered metrics
plugins_errors_fatal:
description: Die on plugins errors
default: no
# Debug mode
# Note that this will automatically be enabled if job fails
debug:
description: Debug logs
default: no
# Ensure SVG can be correctly parsed after generation
verify:
description: Verify SVG
default: no
# Debug flags
debug_flags:
description: Debug flags
default: ""
# Dry-run mode (perform generation without pushing it)
dryrun:
description: Enable dry-run
default: no
# Use mocked data to bypass external APIs
use_mocked_data:
description: Use mocked data instead of live APIs
default: no
# Use a pre-built image from GitHub registry (experimental)
# See https://github.com/users/lowlighter/packages/container/package/metrics for more information
use_prebuilt_image:
description: Use pre-built image from GitHub registry
default: ""
# ====================================================================================
# 📰 Recent activity
# Enable or disable plugin
plugin_activity:
description: Display recent activity
default: no
# Number of activity events to display
plugin_activity_limit:
description: Maximum number of events to display
default: 5
# Filter events by age
# Set to 0 to disable age filtering
plugin_activity_days:
description: Maximum event age
default: 14
# Filter events by type
plugin_activity_filter:
description: Events types to keep
default: all
# Set events visibility (use this to restrict events when using a "repo" token)
plugin_activity_visibility:
description: Set events visibility
default: all
# Display events timestamps
plugin_activity_timestamps:
description: Display events timestamps
default: no
# ====================================================================================
# 🏅 Repository contributors
# Enable or disable plugin
plugin_contributors:
description: Display repository contributors
default: no
# Base reference (commit, tag, branch, etc.)
plugin_contributors_base:
description: Base reference
default: ""
# Head reference (commit, tag, branch, etc.)
plugin_contributors_head:
description: Head reference
default: master
# Ignored contributors (useful to ignore bots users)
plugin_contributors_ignored:
description: Contributors to ignore
default: github-actions[bot]
# Display total contributions for each contributor
plugin_contributors_contributions:
description: Display contributions
default: no
# ====================================================================================
# 🎟️ Follow-up of issues and pull requests
# Enable or disable plugin
plugin_followup:
description: Display follow-up of repositories issues and pull requests
default: no
# ====================================================================================
# 🎫 Gists
# Enable or disable plugin
plugin_gists:
description: Display gists metrics
default: no
# ====================================================================================
# 💡 Coding habits
# Enable or disable plugin
plugin_habits:
description: Display coding habits metrics
default: no
# Number of events to use to computes habits
# Using more will result in more accurate metrics, but you may hit GitHub rate-limit more easily
plugin_habits_from:
description: Number of events to use
default: 200
# Filter used events to compute habits by age
plugin_habits_days:
description: Maximum event age
default: 14
# Display tidbits about your most active hours/days, indents used (spaces/tabs), etc.
# This is deduced from your recent activity
plugin_habits_facts:
description: Display coding habits collected facts based on recent activity
default: yes
# Display charts of most active time of the day and most active day of the week
# Also display languages recently used (this is not the same as plugin_languages, as the latter is an all-time stats)
plugin_habits_charts:
description: Display coding habits charts based on recent activity
default: no
# ====================================================================================
# 🙋 Introduction
# Enable or disable plugin
plugin_introduction:
description: Display account or repository introduction
default: no
# Display introduction section title
plugin_introduction_title:
description: Display introduction section title
default: yes
# ====================================================================================
# 📅 Isometric commit calendar
# Enable or disable plugin
plugin_isocalendar:
description: Display an isometric view of your commits calendar
default: no
# Set time window shown by isometric calendar
plugin_isocalendar_duration:
description: Set time window shown by isometric calendar
default: half-year
# ====================================================================================
# 🈷️ Most used languages
# Enable or disable plugin
plugin_languages:
description: Display most used languages metrics
default: no
# List of languages that will be ignored
plugin_languages_ignored:
description: Languages to ignore
default: ""
# List of repositories that will be skipped
plugin_languages_skipped:
description: Repositories to skip
default: ""
# Overrides default languages colors
# Use `${n}:${color}` to change the color of the n-th most used language (e.g. "0:red" to make your most used language red)
# Use `${language}:${color}` to change the color of named language (e.g. "javascript:red" to make JavaScript language red, language case is ignored)
# Use a value from `colorsets.json` to use a predefined set of colors
# Both hexadecimal and named colors are supported
plugin_languages_colors:
description: Custom languages colors
default: github
# Languages additional details
plugin_languages_details:
description: Additional details
default: ""
# Minimum threshold (in percentage) to reach for languages to be displayed
plugin_languages_threshold:
description: Minimum threshold
default: 0%
# ====================================================================================
# 📜 Repository licenses
# Enable or disable plugin
plugin_licenses:
description: Display licenses informations
default: no
# Command to use to setup target repository
# It is required to install all dependencies that will be analyzed with github/licensed
plugin_licenses_setup:
description: Command to setup target repository
default: ""
# Display used licenses from both repository license and dependencies licenses ratio
plugin_licenses_ratio:
description: Display used licenses ratio
default: no
# Display permissions, limitations and conditions from both repository license and dependencies licenses
# Note that this is NOT legal advice, use at your own risk
plugin_licenses_legal:
description: Display legal informations about used licenses
default: yes
# ====================================================================================
# 👨‍💻 Lines of code changed
# Enable or disable plugin
plugin_lines:
description: Display lines of code metrics
default: no
# ====================================================================================
# 🧑‍🤝‍🧑 People plugin
# Enable or disable plugin
plugin_people:
description: Display GitHub users from various affiliations
default: no
# Number of users to display per section
plugin_people_limit:
description: Maximum number of user to display
default: 28
# Size of displayed user's avatar
plugin_people_size:
description: Size of displayed GitHub users' avatars
default: 28
# List of section to display
# Ordering will be kept
plugin_people_types:
description: Affiliations to display
default: followers, following
# When displaying "thanks" section, specified users list will be displayed
# This is useful to craft "Special thanks" badges
plugin_people_thanks:
description: GitHub users to personally thanks
default: ""
# Use GitHub identicons instead of users' avatar (for privacy purposes)
plugin_people_identicons:
description: Use identicons instead of avatars
default: no
# Shuffle users for varied outputs
# If "plugin_people_limit" is set, plugin will fetch up to 10 ten times limit to ensure output is different each time
plugin_people_shuffle:
description: Shuffle users
default: no
# ====================================================================================
# 🗂️ Active projects
# Enable or disable plugin
plugin_projects:
description: Display active projects
default: no
# Number of projects to display
# Set to 0 to only display "plugin_projects_repositories" projects
# Projects listed in "plugin_projects_repositories" are not affected by this option
plugin_projects_limit:
description: Maximum number of projects to display
default: 4
# List of repository projects to display, using the following format:
# :user/:repo/projects/:project_id
plugin_projects_repositories:
description: List of repository project identifiers to disaplay
default: ""
# Display projects descriptions
plugin_projects_descriptions:
description: Display projects descriptions
default: no
# ====================================================================================
# ✨ Stargazers over last weeks
# Enable or disable plugin
plugin_stargazers:
description: Display stargazers metrics
default: no
# ====================================================================================
# 🌟 Recently starred repositories
# Enable or disable plugin
plugin_stars:
description: Display recently starred repositories
default: no
# Number of stars to display
plugin_stars_limit:
description: Maximum number of stars to display
default: 4
# ====================================================================================
# 📌 Starred topics
# Enable or disable plugin
plugin_topics:
description: Display starred topics
default: no
# Plugin mode
plugin_topics_mode:
description: Plugin mode
default: starred
# Topics sorting order
plugin_topics_sort:
description: Sorting method of starred topics
default: stars
# Number of topics to display
# Set to 0 to disable limitations
# When in "starred" mode, additional topics will be grouped into an ellipsis
plugin_topics_limit:
description: Maximum number of topics to display
default: 15
# ====================================================================================
# 🧮 Repositories traffic
# Enable or disable plugin
plugin_traffic:
description: Display repositories traffic metrics
default: no
# ====================================================================================
# 🌸 Anilist watch list and reading list
# Enable or disable plugin
plugin_anilist:
description: Display data from your AniList account
default: no
# Types of medias to display
plugin_anilist_medias:
description: Medias types to display
default: anime, manga
# Sections to display
# Values from "plugin_anilist_medias" may impact displayed sections
plugin_anilist_sections:
description: Sections to display
default: favorites
# Number of entries to display per section (this does not impacts characters section)
# Set to 0 to disable limitations
plugin_anilist_limit:
description: Maximum number of entries to display per section
default: 2
# Number of entries to display in characters section
# Set to 0 to disable limitations
plugin_anilist_limit_characters:
description: Maximum number of entries to display in characters section
default: 22
# Shuffle AniList data for varied outputs
plugin_anilist_shuffle:
description: Shuffle AniList data
default: yes
# Username on AniList
plugin_anilist_user:
description: AniList login
default: .user.login
# ====================================================================================
# 🎼 Music plugin
# Enable or disable plugin
plugin_music:
description: Display your music tracks
default: no
# Name of music provider
# This is optional for "playlist" mode (it can be deduced automatically from "plugin_music_playlist" url)
# This is required in other modes
plugin_music_provider:
description: Music provider
default: ""
# Music provider token
# This may be required depending on music provider used and plugin mode
# - "apple" : not required
# - "spotify" : required for "recent" mode, format is "client_id, client_secret, refresh_token"
# - "lastfm" : required, format is "api_key"
plugin_music_token:
description: Music provider personal token
default: ""
# Plugin mode
plugin_music_mode:
description: Plugin mode
default: ""
# Embed playlist url (i.e. url used by music player iframes)
plugin_music_playlist:
description: Embed playlist url
default: ""
# Number of music tracks to display
plugin_music_limit:
description: Maximum number of tracks to display
default: 4
# Display when track was last played
plugin_music_played_at:
description: Display when the track was played
default: no
# Username on music provider service
plugin_music_user:
description: Music provider username
default: .user.login
# ====================================================================================
# ⏱️ Website performances
# Enable or disable plugin
plugin_pagespeed:
description: Display a website Google PageSpeed metrics
default: no
# Website to audit with PageSpeed
plugin_pagespeed_url:
description: Audited website
default: .user.website
# Display the following additional metrics from audited website:
# First Contentful Paint, Speed Index, Largest Contentful Paint, Time to Interactive, Total Blocking Time, Cumulative Layout Shift
# See https://web.dev/performance-scoring/ and https://googlechrome.github.io/lighthouse/scorecalc/ for more informations
plugin_pagespeed_detailed:
description: Detailed audit result
default: no
# Display a screenshot of audited website
# May increases significantly filesize
plugin_pagespeed_screenshot:
description: Display a screenshot of your website
default: no
# PageSpeed API token
# This is optional, but providing it will avoid hitting rate-limiter
# See https://developers.google.com/speed/docs/insights/v5/get-started for more informations
plugin_pagespeed_token:
description: PageSpeed token
default: ""
# ====================================================================================
# ✒️ Recent posts
# Enable or disable plugin
plugin_posts:
description: Display recent posts
default: no
# Posts external source
plugin_posts_source:
description: Posts external source
default: ""
# Number of posts to display
plugin_posts_limit:
description: Maximum number of posts to display
default: 4
# Username on external posts source
plugin_posts_user:
description: Posts external source username
default: .user.login
# ====================================================================================
# 🐤 Latest tweets
# Enable or disable plugin
plugin_tweets:
description: Display recent tweets
default: no
# Twitter API token
# See https://apps.twitter.com for more informations
plugin_tweets_token:
description: Twitter API token
default: ""
# Number of tweets to display
plugin_tweets_limit:
description: Maximum number of tweets to display
default: 2
# Twitter username
plugin_tweets_user:
description: Twitter username
default: .user.twitter
# ====================================================================================
# ⏰ WakaTime plugin
# Enable or disable plugin
plugin_wakatime:
description: Display WakaTime stats
default: no
# WakaTime API token
# See https://wakatime.com/settings/account get your API key
plugin_wakatime_token:
description: WakaTime API token
default: ""
# Time range to use for displayed stats
plugin_wakatime_days:
description: WakaTime time range
default: 7
# Sections to display
plugin_wakatime_sections:
description: Sections to display
default: time, projects, projects-graphs, languages, languages-graphs, editors, os
# Number of entries to display per graph
# Set to 0 to disable limitations
plugin_wakatime_limit:
description: Maximum number of entries to display per graph
default: 5
# ====================================================================================
# 💉 Nightscout
# Enable or disable plugin
plugin_nightscout:
description: Displays Blood Glucose
default: no
# Nightscout site URL
plugin_nightscout_url:
description: Your Nightscout site URL
default: https://example.herokuapp.com
# Controls how big the graph is
plugin_nightscout_datapoints:
description: How many datapoints to show on the graph. 0 and 1 disable the graph.
default: 12
# Low value used for colors and text alerts
plugin_nightscout_lowalert:
description: When the blood sugar is considered low
default: 80
# High value used for colors and text alerts
plugin_nightscout_highalert:
description: When the blood sugar is considered high
default: 180
# Urgent low value used for colors and text alerts
plugin_nightscout_urgentlowalert:
description: When the blood sugar is considered urgently low
default: 50
# Urgent high value used for colors and text alerts
plugin_nightscout_urgenthighalert:
description: When the blood sugar is considered urgently high
default: 250
# ====================================================================================
# Action metadata
name: GitHub metrics as SVG image
author: lowlighter
description: An SVG generator with 20+ metrics about your GitHub account! Additional plugins are available to display even more!
branding:
icon: user-check
color: gray-dark
# The action will parse its name to check if it's the official action or if it's a forked one
# On the official action, it'll use the docker image published on GitHub registry when using a released version, allowing faster runs
# On a forked action, it'll rebuild the docker image from Dockerfile to take into account changes you made
runs:
using: composite
steps:
- run: |
# Create environment file from inputs and GitHub variables
cd $METRICS_ACTION_PATH
touch .env
for INPUT in $(echo $INPUTS | jq -r 'to_entries|map("INPUT_\(.key|ascii_upcase)=\(.value|@uri)")|.[]'); do
echo $INPUT >> .env
done
env | grep -E '^(GITHUB|ACTIONS|CI)' >> .env
echo "Environment variable: loaded"
# Source repository (picked from action name)
METRICS_SOURCE=$(echo $METRICS_ACTION | sed -E 's/metrics.*?$//g')
echo "Source: $METRICS_SOURCE"
# Version (picked from package.json)
METRICS_VERSION=$(grep -Po '(?<="version": ").*(?=")' package.json)
echo "Version: $METRICS_VERSION"
# Image tag (extracted from version or from env)
METRICS_TAG=v$(echo $METRICS_VERSION | sed -r 's/^([0-9]+[.][0-9]+).*/\1/')
if [[ $METRICS_USE_PREBUILT_IMAGE ]]; then
METRICS_TAG=$METRICS_USE_PREBUILT_IMAGE
echo "Pre-built image: yes"
fi
echo "Image tag: $METRICS_TAG"
# Image name
# Pre-built image
if [[ $METRICS_USE_PREBUILT_IMAGE ]]; then
echo "Using pre-built version $METRICS_TAG, will pull docker image from GitHub registry"
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
docker image pull $METRICS_IMAGE > /dev/null
# Official action
elif [[ $METRICS_SOURCE == "lowlighter" ]]; then
# Is released version
set +e
METRICS_IS_RELEASED=$(expr $(expr match $METRICS_VERSION .*-beta) == 0)
set -e
echo "Is released version: $METRICS_IS_RELEASED"
# Use registry for released version
if [[ "$METRICS_IS_RELEASED" -gt "0" ]]; then
echo "Using released version $METRICS_TAG, will pull docker image from GitHub registry"
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
docker image pull $METRICS_IMAGE > /dev/null
# Rebuild image for unreleased version
else
echo "Using an unreleased version ($METRICS_VERSION)"
METRICS_IMAGE=metrics:$METRICS_VERSION
fi
# Forked action
else
echo "Using a forked version"
METRICS_IMAGE=metrics:forked-$METRICS_VERSION
fi
echo "Image name: $METRICS_IMAGE"
# Build image if necessary
set +e
docker image inspect $METRICS_IMAGE > /dev/null
METRICS_IMAGE_NEEDS_BUILD="$?"
set -e
if [[ "$METRICS_IMAGE_NEEDS_BUILD" -gt "0" ]]; then
echo "Image $METRICS_IMAGE is not present locally, rebuilding it from Dockerfile"
docker build -t $METRICS_IMAGE . > /dev/null
else
echo "Image $METRICS_IMAGE is present locally"
fi
# Run docker image with current environment
docker run --volume $GITHUB_EVENT_PATH:$GITHUB_EVENT_PATH --env-file .env $METRICS_IMAGE
rm .env
shell: bash
env:
METRICS_ACTION: ${{ github.action }}
METRICS_ACTION_PATH: ${{ github.action_path }}
METRICS_USE_PREBUILT_IMAGE: ${{ inputs.use_prebuilt_image }}
INPUTS: ${{ toJson(inputs) }}