Skip to content

Merge branch 'main' of github.com:novica/r-project-template #3

Merge branch 'main' of github.com:novica/r-project-template

Merge branch 'main' of github.com:novica/r-project-template #3

Workflow file for this run

name: Generate Documentation
on:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/generate-docs.yml"
- "src/package_name/**" # rebuild if API docs change
permissions:
contents: write # needed to push to gh-pages
concurrency:
group: docs-pages
cancel-in-progress: true
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: "4.5"
- name: Install rv
run: curl -sSL https://raw.githubusercontent.com/A2-ai/rv/refs/heads/main/scripts/install.sh | bash
- name: Sync project
run: rv sync
- name: Run Quartrify
run: Rscript -e "quartify::rtoqmd_dir('src/package_name/', render = TRUE, output_html_dir = '../../docs/html', exclude_pattern='__tests__')"
- name: Move generated .qmd files to docs/ #quartrify generates .qmd files next to the source .R files. it would be better if they are in docs.
run: |
find src/package_name/ -name "*.qmd" -exec mv {} docs/ \;
mv src/package_name/_quarto.yml docs/
- name: Create Pull Request with generated docs
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(docs): add generated documentation"
branch: "docs/generated-${{ github.run_id }}"
title: "Add generated documentation"
body: "This PR adds generated .qmd and .html documentation into docs/ and docs/html/."
base: main
labels: |
autogenerated
documentation