npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lastfm-readme

v1.4.2

Published

GitHub Action to dynamically update your GitHub README with Last.fm metrics

Downloads

33

Readme

GitHub README Last.fm Metrics

Dynamically update your GitHub README.md with Last.fm metrics.

MIT github.release.badge actions.codeql.badge

⚡ Usage

Preparation

Last.fm API Key

Create a Last.fm API account if you don't have one to receive an API Key.

Save GitHub Action Secrets

Navigate to your repositories Settings → Secrets and variables → Actions → New repository secret to add the following secrets:

| Name | Value | | :--------------: | :-------------------------------------------------: | | LASTFM_API_KEY | A valid Last.fm API Key | | GH_TOKEN* | A GitHub Access Token with the repo scope granted |

* GH_TOKEN is only required when the intention is to modify a README.md file in a repository outside where the workflow is running.

Update the workflow permissions on your repository

Navigate to your repositories Settings → Actions → General → Workflow permissions and select the Read and write permissions option.

workflow-permissions.png

Add chart HTML comments to your README

The README.md file must contain HTML comments that identify where the charts should be inserted. Commonly, a profile repository is used to host the README.md file.

Note See the Charts section for configuration details.

Example Workflow

name: Last.fm Charts

on:
  workflow_dispatch: # Allow manual triggering of workflow
  schedule:
    # Run every 6 hours
    - cron: '0 */6 * * *'

jobs:
  lastfm-metrics:
    name: Update Last.fm Charts
    runs-on: ubuntu-latest
    steps:
      - uses: dxnter/lastfm-readme@v1
        with:
          LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
          LASTFM_USER: dxnter
          # The following inputs below are only required when the intention is to modify a README.md file in a repository outside where the workflow is running
          #GH_TOKEN: ${{ secrets.GH_TOKEN }}
          #REPOSITORY: <gh_username/gh_username>

Inputs

| Setting | Default | Accepted Values | Description | | :--------------: | :------------------------------: | :---------------------------------------------------------------------------------: | :-------------------------------------------------------: | | LASTFM_API_KEY | N/A | Last.fm API Key | A valid Last.fm API Key | | LASTFM_USER | N/A | Last.fm username | The Last.fm user to fetch metrics from | | GH_TOKEN | ${{ github.token }} | GitHub access token | An access token with the repo scope granted. | | REPOSITORY | <gh_username>/<gh_username> | <gh_username>/<repo_name> | Repository that should have the README.md file updated. | | COMMIT_MESSAGE | chore: update Last.fm sections | Any string | Commit message used when sections are updated | | SHOW_TITLE | true | true / false | Toggle the title shown above sections | | LOCALE | en-US | BCP 47 tag | Locale used for formatting numbers | | DATE_FORMAT | MM/dd/yyyy | date-fns date format | Date format used in the User Info section |

📊 Charts

All charts are identified by HTML comments that contain a valid chart name and an optional JSON configuration object followed by a closing HTML comment.

Chart with the default configuration (period: "7day", rows: 8)
<!--START_LASTFM_...-->
<!--END_LASTFM_...-->

Chart with a custom configuration
<!--START_LASTFM_...:{"period": "overall", "rows": 3}-->
<!--END_LASTFM_...-->

🎤️ Top Artists

Display the top listened to artists over a given period of time.

Example

<!--START_LASTFM_ARTISTS:{"period": "6month", "rows": 3}-->
<!--END_LASTFM_ARTISTS-->

Output

top-artists.png

Configuration

| Option | Default | Options | Description | | :------: | :-----: | :--------------------------------------------------------: | :-------------------------------------: | | period | 7day | 7day, 1month, 3month, 6month, 12month, overall | The period of time to display data from | | rows | 8 | 1 ≤ integer ≤ 50 | The number of artists to display |

💿 Top Albums

Display the top listened to albums over a given period of time.

Example

<!--START_LASTFM_ALBUMS:{"period": "1month", "rows": 3}-->
<!--END_LASTFM_ALBUMS-->

Output

top-albums.png

Configuration

| Option | Default | Options | Description | | :------: | :-----: | :--------------------------------------------------------: | :-------------------------------------: | | period | 7day | 7day, 1month, 3month, 6month, 12month, overall | The period of time to display data from | | rows | 8 | 1 ≤ integer ≤ 50 | The number of albums to display |

🎵 Top Tracks

Display the top listened to tracks over a given period of time.

Example

<!--START_LASTFM_TRACKS:{"period": "1month", "rows": 3}-->
<!--END_LASTFM_TRACKS-->

Output

top-tracks.png

Configuration

| Option | Default | Options | Description | | :------: | :-----: | :--------------------------------------------------------: | :-------------------------------------: | | period | 7day | 7day, 1month, 3month, 6month, 12month, overall | The period of time to display data from | | rows | 8 | 1 ≤ integer ≤ 50 | The number of tracks to display |

🔊 Recent Tracks

Display recently listened to tracks.

Example

<!--START_LASTFM_RECENT:{"rows": 3}-->
<!--END_LASTFM_RECENT-->

Output

Default

recent-tracks.png

Track currently playing

recent-tracks-now-playing.png

Configuration

| Option | Default | Options | Description | | :----: | :-----: | :--------------: | :------------------------------------: | | rows | 8 | 1 ≤ integer ≤ 50 | The number of recent tracks to display |

ℹ️ User Info

Display information about a Last.fm user. An optional configuration object can be passed to specify which properties to display.

Example (Default)

<!--START_LASTFM_USER_INFO-->
<!--END_LASTFM_USER_INFO-->

Output

recent-tracks.png

Example (Custom Configuration)

<!--START_LASTFM_USER_INFO:{"display": ["playcount", "artistCount"]}-->
<!--END_LASTFM_USER_INFO-->

Output

user-info-custom.png

Configuration

| Option | Default | Options | Description | | :-------: | :----------------------------------------------------------------------: | :----------------------------------------------------------: | :------------------------------------------------: | | display | ["registered", "playcount", "artistCount", "albumCount", "trackCount"] | registered, playcount, artistCount, albumCount, trackCount | A list of properties to be included in the section |

🌟 Acknowledgements