-
-
Notifications
You must be signed in to change notification settings - Fork 104
43 lines (40 loc) · 1.5 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 "github-actions@github.com"
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"