Update README.qmd #62
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
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 }} # Deployment key from your secrets | |
persist-credentials: false # Prevent GitHub Actions from overwriting credentials | |
- 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 --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add . | |
git commit -m "Render README.qmd files to gfm" || echo "No changes to commit" | |
git fetch origin | |
# Ensure the remote URL is SSH | |
git remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git | |
# Set up SSH key for deployment key | |
mkdir -p ~/.ssh | |
echo "${{ secrets.RENDER_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
# Push changes via SSH with deployment key | |
git push origin main |