This repository has been archived on 2025-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
coryd.dev-eleventy/.github/workflows/fetch-artist-charts.yaml
2024-02-13 09:49:50 -08:00

30 lines
1.1 KiB
YAML

name: Fetch weekly artist charts
on:
workflow_dispatch:
schedule:
- cron: '00 09 * * 5'
jobs:
FetchArtistCharts:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout out this repo
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Fetch charts
run: |
echo "CHART_DATA=$(curl 'https://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&user=coryd_&api_key=${{ secrets.LASTFM_API_KEY }}&format=json')" >> "$GITHUB_ENV"
- name: Update charts
run: |
echo "CHARTS=$(cat src/_data/json/weekly-artist-charts.json | jq -c --argjson jq_data "$CHART_DATA" '.charts += [$jq_data]')" >> "$GITHUB_ENV"
- name: Write charts
run: |
echo $CHARTS > src/_data/json/weekly-artist-charts.json
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update artist charts for the week.
commit_user_name: cdransf
commit_user_email: coryd@hey.com