-
Notifications
You must be signed in to change notification settings - Fork 2
53 lines (43 loc) · 1.52 KB
/
render-README.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
44
45
46
47
48
49
50
51
52
53
name: Render README.qmd to Markdown
on:
push:
branches:
- main
jobs:
render:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.RENDER_KEY }}
- name: Set up SSH for Git
run: |
mkdir -p ~/.ssh
echo "${{ secrets.RENDER_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- name: Set up R
uses: r-lib/actions/setup-r@v2
- name: Install Required R Packages
run: |
Rscript -e 'if (!requireNamespace("rmarkdown", quietly = TRUE)) install.packages("rmarkdown", repos = "https://cloud.r-project.org/")'
Rscript -e 'if (!requireNamespace("knitr", quietly = TRUE)) install.packages("knitr", repos = "https://cloud.r-project.org/")'
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Find and Render README.qmd Files
run: |
find . -name "README.qmd" | while read qmd_file; do
quarto render "$qmd_file" --to gfm
done
- name: Commit and Push Rendered Files
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Render README.qmd files to gfm" || echo "No changes to commit"
git fetch origin
# Push changes via SSH with deployment key
git push origin main