Skip to content

update

update #344

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: "10 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
with:
fetch-depth: 0
- 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: Install graphicsmagick
run: sudo apt install --yes graphicsmagick
- name: Create Movie
run: scripts/movie_last_100_days.sh
- name: Commit and push
uses: EndBug/add-and-commit@v9
with:
add: '["graphs/top50us.png", "data/top50.csv", "data/top50.rds", "graphs/movie_last_n_days.gif"]'
push: true
default_author: github_actions
message: 'Update graphs and data'