chore: cache charts
This commit is contained in:
parent
8320c4cf24
commit
a2d50cee46
4 changed files with 33 additions and 31 deletions
14
.github/workflows/fetch-artist-charts.yaml
vendored
14
.github/workflows/fetch-artist-charts.yaml
vendored
|
@ -13,11 +13,15 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Fetch current artist charts
|
||||
run: |-
|
||||
data=$(curl 'https://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&user=coryd_&api_key=${{ secrets.LASTFM_API_KEY }}&format=json') \
|
||||
charts=$(src/_data/json/weekly-artist-charts.json | jq --argjson jq_data "${data}" '.charts += [$jq_data]') \
|
||||
echo $charts > src/_data/json/weekly-artist-charts.json
|
||||
- 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:
|
||||
|
|
Reference in a new issue