Skip to content

Various GH workflow improvements #137

Various GH workflow improvements

Various GH workflow improvements #137

name: Documentation
on: [push, pull_request]
jobs:
MakeDocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2-branch
with:
r-version: '4.1.0'
- name: Create Documentation directory
run: |
echo "Creating 'Documentation"
mkdir -p documentation
- name: Install knitr dependency
run: |
echo "Installing R package dependencies. Scripts might have additional dependencies installed."
Rscript -e 'if (!require(knitr)) install.packages("knitr")'
- name: Documentation compilation
run: 'Rscript .github/scripts/doc_builder.r'
- name: Setup Git
run: |
echo "Setting up Git"
git config --global user.name github-actions[bot]
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Creating a branch
run: |
git checkout -b docs_update-${{ github.sha }}
- name: Commit and push changes
run: |
if [[ `git status --porcelain` ]];
then
echo "Staging and committing documentation changes"
git add documentation/
git commit -m "Update documentation" || true
git push origin docs_update-${{ github.sha }}:docs_update-${{ github.sha }}
gh pr create --base ${GITHUB_REF##*/} --head docs_update-${{ github.sha }} --title '' --body 'Updated the documentation files (see the diff. for changes).' || true
fi