-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.11 KB
/
knit-rmd.yaml
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
44
45
46
47
name: Knit Rmd Files
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
knit:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install dependencies
run: |
Rscript -e 'install.packages(c("rmarkdown", "knitr"))'
- name: Find and knit Rmd files
run: |
Rscript -e '
rmd_files <- list.files(pattern = "\\.Rmd$", recursive = TRUE)
for (file in rmd_files) {
rmarkdown::render(file)
}
'
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Knit Rmd files" || echo "No changes to commit"
- name: Push changes
uses: ad-m/[email protected]
with:
branch: ${{ github.head_ref }}