.github/workflows/main.yml #110
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 */3 * *' | |
#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 | |
any::jsonlite | |
- name: Web Crawling | |
run: source("gov_website.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 |