Skip to content

daily-sync

daily-sync #739

Workflow file for this run

name: daily-sync
on:
workflow_dispatch
jobs:
test-data:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v2-branch
- name: Install R packages
run: Rscript -e 'install.packages(c("devtools","aws.s3","usethis"))'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests on data on s3
run: Rscript -e 'install.packages(c("devtools","aws.s3","usethis"))' -e 'b <- Sys.getenv("BUCKET")' \
-e 'aws.s3::s3load(bucket = b, object = "ufc_stats.rda")' \
-e 'usethis::use_data(ufc_stats, overwrite = TRUE)' -e 'devtools::check(error_on = "error")'
env:
ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
BUCKET: ${{ secrets.AWS_S3_BUCKET }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
sync-data:
needs: test-data
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: mtoto/s3-sync-action@master
with:
args: --follow-symlinks
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
SOURCE_DIR: ${{ secrets.SOURCE_DIR }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
DEST_DIR: 'data'
DEST_FILE: 'ufc_stats.rda'
update-readme:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: r-lib/actions/setup-r@v2-branch
- uses: r-lib/actions/setup-pandoc@v2-branch
- name: Install rmarkdown
run: Rscript -e 'install.packages(c("rmarkdown","devtools"))'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Render README
run: Rscript -e 'rmarkdown::render("README.Rmd")'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Commit results
run: |
git pull origin master && git diff --quiet && git diff --staged --quiet || git commit -am "Re-build README.Rmd & update datasets"
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:master