Skip to content
award

GitHub Action

MonkeyType Stats - Readme

v1.0.1 Latest version

MonkeyType Stats - Readme

award

MonkeyType Stats - Readme

Update monkeytype personal best in your Readme

Installation

Copy and paste the following snippet into your .yml file.

              

- name: MonkeyType Stats - Readme

uses: vnphanquang/[email protected]

Learn more about this action in vnphanquang/monkeytype-readme

Choose a version

Monkeytype Stats in Github Readme

codecov.badge github.release.badge semantic-release.badge MIT

actions.ci.badge actions.release.badge

tweet

Table of Contents

Show / hide

Demo

Style variants: show / hide
style demo
flat monkeytype.badge.flat
flat-square monkeytype.badge.flat-square
plastic monkeytype.badge.plastic
for-the-badge monkeytype.badge.for-the-badge
Icon variant: show / hide
icon demo
one monkeytype.badge.for-the-badge
two monkeytype.badge.for-the-badge-two

Preparation

Static Usage

Show / hide

This project's strategy relies on shields.io endpoint api. For one time & static badge, follow the steps below.

  1. Edit this endpoint to your liking:

    https://monkeytype-badge-vhd5lan7mmhz.runkit.sh?message=...&label=...&logoVarient=...
    

    See Endpoint Documentation for more details about the query params.

  2. Parse (1) and use shields.io endpoint helper to further customize your badge.

    shields.io.endpoint.customize

Dynamic Github Readme Update

Show / hide

1. Readme Resource Declaration

Put the following at the bottom of your README. This is a default badge that will get updated by the github action...

[monkeytype.badge]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fmonkeytype-badge-vhd5lan7mmhz.runkit.sh

You can display this badge somewhere in your readme as below, which will render similar to those in the Demo section.

monkeytype.badge.default

<!-- For just the image -->
![!monkeytype.badge]

<!-- For clickable image that links to monkeytype website -->
[![monkeytype.badge]](https://monkeytype.com/)

2. Monkeytype API Key

Go to monkeytype.settings, search for the ape key section, then generate and save an API Key somewhere for the next step

monkeytype.settings.ape-key

Add this key as a Action secret in your repo's settings.

screenshots.github-secret

Now follow the next section to set up a github workflow.

Github Action Workflow

See action.yaml for description about the inputs.

I recommend keeping the workflow_dispatch trigger so you can run the action manually whenever you want.

Since personal bests don't change that often, in the example I leave it to run once every week. But you can use the crontab-guru site to adjust as needed.

Example: show / hide
# .github/workflow/monkeytype.yaml
name: Monkeytype Readme

on:
  # Runs if triggered manually through github action console
  workflow_dispatch:
  schedule:
    # Runs at 00:00 each sunday
    - cron: '0 0 * * 0'

jobs:
  update-readme:
    name: Update this repo's README
    runs-on: ubuntu-latest
    steps:
      - uses: vnphanquang/monkeytype-readme@main
        with:
          # required:
          monkeytype_api_key: ${{ secrets.MONKEYTYPE_API_KEY }}
          mode: 'time'
          mode2: '30'
          # not required with default:
          style: 'flat'
          logoVariant: 'one'
          label: 'monkeytype'
  # outputs badge_url should you need to use that in later steps

Endpoint Documentation

See the code on runkit. The endpoint is:

https://monkeytype-badge-vhd5lan7mmhz.runkit.sh
Query params: show / hide
name required default description
message no calculating message to display on the badge, usually something like '120wpm'
logoVariant no one the logo variant to use, see Demo. Accepts only the string one or two
label no monkeytype the text next to the icon

tweet

buy vnphanquang a coffee