Update shanghai_petition.R #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#on: | |
#schedule: | |
#- cron: '00 12 */7 * *' | |
on: | |
push: | |
branches: main | |
jobs: | |
update-report: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 # Cache packages so won't be compiled everytime job is run | |
with: | |
path: ~/.local/share/renv | |
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} | |
restore-keys: | | |
${{ runner.os }}-renv- | |
- name: Install packages | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | | |
any::tidyverse | |
any::rio | |
any::rvest | |
any::httr2 | |
- name: Scrape | |
run: source("shanghai_petition.R") | |
shell: Rscript {0} | |
- name: Commit files | |
run: | | |
git config --local user.name actions-user | |
git config --local user.email "actions@github.com" | |
git add data/* | |
git commit -am "GH ACTION Headlines $(date)" | |
git push origin main | |
env: | |
REPO_KEY: ${{secrets.GITHUB_TOKEN}} | |
username: github-actions |