Skip to content

update

update #18

Workflow file for this run

# Simple action to fetch data, update chart and commit changes
# Uses r2u container for ease of R package installation
name: update
on:
#push:
# branches: [main, master]
#release:
schedule:
- cron: "31 10 * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
# Give default GITHUB_TOKEN write permission to commit and push the changed files back to repo.
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup r2u
uses: eddelbuettel/github-actions/r2u-setup@master
- name: SessionInfo
run: R -q -e 'sessionInfo()'
- name: Package Dependencies
# takes advantage of r2u to install the named CRAN packages as binaries
# in the r2u context we could also use script 'install.r'
run: Rscript -e 'install.packages(c("tinyspotifyr", "ggplot2", "anytime", "data.table", "tinythemes"))'
- name: Update Data
env:
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
run: Rscript scripts/top50fetch.R
- name: Update Chart
run: Rscript scripts/top50chart.R
- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
add: '["graphs/top50us.png", "data/top50.csv", "data/top50.rds"]'
push: true
default_author: github_actions
message: 'Update graphs and data'