How to use Spotify plugin on the website #132
-
I really want access to all features listed on the website but some of the options are non clickable - when will we be able to use these? Specifically the Spotify one. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
Hello ! You just need use metrics as a GitHub action to actually be able to use all features. Basically you create a new file in Milo123459/Milo123459/.github/workflows with at least the following : (seems you're already familiar with workflows since you have already some in your repository, if not, you can follow README.md - ⚙️ Using GitHub Action on your profile repository (~5 min setup) and expand name: Metrics
on:
# Schedule updates
schedule: [{cron: "0 * * * *"}]
# Lines below let you run workflow manually and on each commit
push: {branches: ["master", "main"]}
workflow_dispatch:
jobs:
github-metrics:
runs-on: ubuntu-latest
steps:
# See action.yml for all options
- uses: lowlighter/metrics@latest
with:
# Your GitHub token
token: ${{ secrets.METRICS_TOKEN }}
# GITHUB_TOKEN is a special auto-generated token restricted to current repository, which is used to push files in it
committer_token: ${{ secrets.GITHUB_TOKEN }}
# For spotify you add these options
plugin_music: yes
plugin_music_provider: spotify
plugin_music_token: "${{ secrets.SPOTIFY_CLIENT_ID }}, ${{ secrets.SPOTIFY_CLIENT_SECRET }}, ${{ secrets.SPOTIFY_REFRESH_TOKEN }}"
plugin_music_mode: recent
plugin_music_limit: 4 You'll also need to add the following secrets in your repository to make it work :
All options disabled on website are actually available in the action version, and their documentation in hidden in README.md - 🧩 Plugins, you need to click on Unavailable features on the website are usually disabled because they consume too much APIs requests (and they're limited by GitHub) for a single user or require additional setup (like for spotify a token from user is needed). To keep the service available for everyone and to avoid storing people's personal data (especially tokens which are sensitive informations), these plugins will probably never be enabled on the web instance, but you can use them with the GitHub action. That's why the music plugin on the website only support playlist mode (because you just provide a public playlist url), while the recently listened mode is disabled because metrics needs a spotify token and an authorization from your account to access your music history. GitHub action is the way to go if you want to use all features 🙂 Hope it helps ! |
Beta Was this translation helpful? Give feedback.
-
Oh, sorry for bothering, one more question, does the action still display an image? @lowlighter |
Beta Was this translation helpful? Give feedback.
-
It does! Just need to know, how do I setup the repository one? |
Beta Was this translation helpful? Give feedback.
-
No problems ! Not sure about which one you're talking about for the second question. If you mean the "Repositories" section (displaying how many repository you have, most used license, releases, forks, etc.) then it's located in - uses: lowlighter/metrics@latest
with:
base: repositories If you're talking about the - uses: lowlighter/metrics@latest
with:
user: "repository-owner" # optional if you own the repo and you're using your own token
query: '{"repo":"repository-name"}' All the examples above still requires you pass the Additionaly, you can generate multiple images by using more steps and changing You can take a look at personal workflow for more examples, but it's a bit bloated since it hosts all metrics images displayed on this repository, but at least it's 100% sure you'll find the one you search since it illustrates all features of metrics 🙂 |
Beta Was this translation helpful? Give feedback.
-
Well, I wanted one to display the traffic of people viewing my repository (a different one) every 2 weeks, thanks. |
Beta Was this translation helpful? Give feedback.
-
The following should work : - name: Traffic plugin
uses: lowlighter/metrics@latest
with:
token: ${{ secrets.METRICS_TOKEN }}
committer_token: ${{ secrets.GITHUB_TOKEN }}
base: "repositories" # or more, but repositories is required
plugin_traffic: yes Note you need to add "repo" scope in your personal token. If you already generated it, you can still update scopes from your GitHub account settings |
Beta Was this translation helpful? Give feedback.
-
Can I get the traffic for one repo? |
Beta Was this translation helpful? Give feedback.
-
Yes it also works on the repository template 🙂 |
Beta Was this translation helpful? Give feedback.
Hello !
You just need use metrics as a GitHub action to actually be able to use all features.
Basically you create a new file in Milo123459/Milo123459/.github/workflows with at least the following :
(seems you're already familiar with workflows since you have already some in your repository, if not, you can follow README.md - ⚙️ Using GitHub Action on your profile repository (~5 min setup) and expand
💬 How to setup?
section)