Render README #1896
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- README.Rmd | |
- .github/workflows/main.yml | |
schedule: | |
- cron: '0 12 * * *' | |
name: Render README | |
jobs: | |
render: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
name: Render README | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Prepare repository | |
run: git checkout "${GITHUB_REF:11}" | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 5 | |
- name: Render README | |
run: | | |
rmarkdown::render("README.Rmd", output_format = "github_document", params = list(AIRTABLE_API_KEY = ${{ secrets.AIRTABLE_API_KEY }})) | |
rmarkdown::render("README.es.Rmd", output_format = "github_document", params = list(AIRTABLE_API_KEY = ${{ secrets.AIRTABLE_API_KEY }})) | |
shell: Rscript {0} | |
env: # Set the secrets as an input | |
AIRTABLE_API_KEY: ${{ secrets.AIRTABLE_API_KEY }} | |
AIRTABLE_ID: ${{ secrets.AIRTABLE_ID }} | |
- name: Commit results | |
run: | | |
git config user.name "Github Actions" | |
git config user.email "[email protected]" | |
git commit README.md README.es.md -m 'Re-build README.Rmd' || echo "No changes to commit" | |
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git HEAD:${{ github.ref }} || echo "No changes to commit" |