Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH actions for rendering of README.Rmd #17

Merged
merged 37 commits into from
Dec 13, 2024
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
13609af
Included render-markdown.yaml for GH actions rendering of README.Rmd.…
jibarozzo Dec 11, 2024
091d90d
Update render-rmarkdown.yaml
jibarozzo Dec 11, 2024
9890f7c
Update README.Rmd
jibarozzo Dec 11, 2024
a7e25f3
Improved render-rmarkdown.yaml structure
jibarozzo Dec 11, 2024
dd1c3f5
Update render-rmarkdown.yaml
jibarozzo Dec 11, 2024
281b753
New permissions
jibarozzo Dec 11, 2024
472fd38
Removing control flow to trigger GH action
jibarozzo Dec 11, 2024
57467f6
Changing GH action trigger
jibarozzo Dec 11, 2024
2dd74f4
Yet another GH action trigger update
jibarozzo Dec 11, 2024
ea40b43
Adding control flow
jibarozzo Dec 11, 2024
2ab2a6b
Update README.Rmd
jibarozzo Dec 11, 2024
00ad9ab
Adding concurrency grout to render-rmarkdown.yaml
jibarozzo Dec 11, 2024
7369d9a
Ensuring render-rmarkdown.yaml doesn't fail even if .Rmd has no changes
jibarozzo Dec 11, 2024
ecbef95
Revert testing example
jibarozzo Dec 12, 2024
0eba07d
Update .github/workflows/render-rmarkdown.yaml
jibarozzo Dec 12, 2024
a914c11
Checking out PR branch
jibarozzo Dec 12, 2024
3d2c11c
Adding fetch-dept = 0
jibarozzo Dec 12, 2024
2f215b0
Update README.Rmd
jibarozzo Dec 12, 2024
9ce7100
Adding GH context refs
jibarozzo Dec 12, 2024
4e003d6
Change to PR branch job
jibarozzo Dec 12, 2024
3360a76
PR branch job to github.ref
jibarozzo Dec 12, 2024
19e88e5
Targeting github.base.ref
jibarozzo Dec 12, 2024
72ea433
typo fix
jibarozzo Dec 12, 2024
4352cbd
Reverting to github.ref
jibarozzo Dec 12, 2024
8da832e
Update README.Rmd
jibarozzo Dec 12, 2024
845f0f5
Typo in R chunk README.Rmd
jibarozzo Dec 12, 2024
f5eaae5
Adding push origin HEAD: to Commit Results job
jibarozzo Dec 12, 2024
8e95a9d
Update README.Rmd
jibarozzo Dec 12, 2024
09dac1f
Setting correct HEAD for commit
jibarozzo Dec 12, 2024
622d6ba
Update README.Rmd
jibarozzo Dec 12, 2024
bdfff93
Merge 622d6badd64aecefdba69927779c57e034249ea2 into ac3d506a2058fc753…
jibarozzo Dec 12, 2024
25d9967
Re-build RMarkdown files
jibarozzo Dec 12, 2024
d14b064
Update README.Rmd
jibarozzo Dec 13, 2024
da8472b
Install local package through `local::.`
jibarozzo Dec 13, 2024
f60b158
Update README.Rmd
jibarozzo Dec 13, 2024
d5e70e7
Merge f60b1587fe12df27e2bb618d591079ce278778e5 into ac3d506a2058fc753…
jibarozzo Dec 13, 2024
070061f
Re-build RMarkdown files
jibarozzo Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/render-rmarkdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
pull_request:
release:
types: [published]
workflow_dispatch:

name: render-rmarkdown.yaml

permissions: read-all

jobs:
render-rmarkdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: rmarkdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write

steps:
- name: Showing GH context refs
shell: bash
run: |
echo github.head_ref: ${{ github.head_ref }}
echo github.ref: ${{ github.ref }}
echo github.ref_name: ${{ github.ref_name }}
echo github.base.ref: ${{ github.base_ref }}

- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: 'latest'

- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Setup R Dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rmarkdown, local::.

- name: Render RMarkdown files
shell: bash
run: |
RMD_PATH=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.Rmd$' || true)
jdhoffa marked this conversation as resolved.
Show resolved Hide resolved
if [ -n "$RMD_PATH" ]; then
Rscript -e 'for (f in commandArgs(TRUE)) if (file.exists(f)) rmarkdown::render(f)' ${RMD_PATH[*]}
echo "RMD_PATH=$RMD_PATH" >> $GITHUB_ENV
else
echo "No RMarkdown files changed."
fi

- name: Commit Results
shell: bash
run: |
if [ -n "$RMD_PATH" ]; then
MD_FILES=$(echo "$RMD_PATH" | sed 's/\.Rmd$/\.md/')
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "[email protected]"
git add $MD_FILES
git commit -m 'Re-build RMarkdown files' || echo "Re-build changes to commit"
git push origin HEAD:${{ github.head_ref }} || echo "Changes pushed to ${{ github.head_ref }} to commit"
jibarozzo marked this conversation as resolved.
Show resolved Hide resolved
else
echo "No Markdown files to commit."
fi