Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ jobs:
fetch-depth: 0

- name: Run render for Rmd
uses: ottrproject/ottr-preview@cansavvy/docker-swap
uses: ottrproject/ottr-preview@testweb
with:
toggle_website: "rmd"
root_path: test-rmd

- name: Run render for Quarto
uses: ottrproject/ottr-preview@cansavvy/docker-swap
uses: ottrproject/ottr-preview@testweb
with:
toggle_website: "quarto"
root_path: test-quarto

- name: Run render for Rmd_web
uses: ottrproject/ottr-preview@testweb
with:
toggle_website: "rmd_web"
root_path: test-rmd_web
28 changes: 24 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,13 @@ runs:
if: ${{ inputs.preview == 'true' }}
id: build-components
run: |
docx_file=$(ls ${{ inputs.root_path }}/docs/*.docx || echo NA)
docx_file=$(ls ./docs/*.docx 2>/dev/null | head -1 || true)
if [ -n "$docx_file" ]; then
docx_link="https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/$docx_file"
else
docx_link="NA"
fi
bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/${{ inputs.root_path }}/docs/index.html")
docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/$docx_file")
zip_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/${{ inputs.root_path }}/website-preview.zip")
echo "zip_link=$zip_link" >> $GITHUB_OUTPUT
echo "bookdown_link=$bookdown_link" >> $GITHUB_OUTPUT
Expand All @@ -162,8 +166,8 @@ runs:
echo ${{steps.commit.outputs.changes}}
shell: bash

- name: Create or update comment
if: ${{ inputs.preview == 'true' }}
- name: Create or update comment (with docx file)
if: ${{ inputs.preview == 'true' && steps.build-components.outputs.docx_link != "NA" }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
Expand All @@ -179,6 +183,22 @@ runs:
_Updated at ${{ steps.build-components.outputs.time }} with changes from the latest commit ${{ steps.build-components.outputs.commit_id }}_
edit-mode: replace

- name: Create or update comment (without docx file)
if: ${{ inputs.preview == 'true' && steps.build-components.outputs.docx_link == "NA" }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
Re-rendered previews from the latest commit:
- :eyes: Quick [preview of course website here](${{ steps.build-components.outputs.bookdown_link }}) \*
- :microscope: Comprehensive [download of the course website here](${{ steps.build-components.outputs.zip_link }})

\* note not all html features will be properly displayed in the "quick preview" but it will give you a rough idea.

_Updated at ${{ steps.build-components.outputs.time }} with changes from the latest commit ${{ steps.build-components.outputs.commit_id }}_
edit-mode: replace

- name: Comment if no changes
if: ${{ inputs.preview == 'true' && steps.commit.outputs.changes == 'false' }}
uses: peter-evans/create-or-update-comment@v2
Expand Down
18 changes: 18 additions & 0 deletions test-rmd_web/_site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: OTTR Template Website Test
output_dir: 'docs'
navbar:
title: OTTR Web Test
left:
- text: ""
href: index.html
icon: fa-home

output:
html_document:
theme: cosmo
lib_dir: site_libs
self_contained: no
highlight: textmate
css: styles.css
includes:
in_header: resources/header.html
28 changes: 28 additions & 0 deletions test-rmd_web/config_automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

##### Checks run at pull request #####
# Check quiz formatting
check-quizzes: no
# Check that urls in the content are not broken
url-checker: yes
# Render preview of content with changes (Rmd's and md's are checked)
render-preview: yes
# Spell check Rmds and quizzes
spell-check: yes
# Style any R code
style-code: yes
# Would you like your markdown files to be checked for formatting
markdown-linter: yes
# Would you like a readability report on your markdowns?
readability-report: yes
# Test build the docker image if any docker-relevant files have been changed
docker-test: no
# Should URLs be tested periodically?
url-check-periodically: yes

##### Renderings run upon merge to main branch #####
# Rendering each platform's content
render-website: rmd_web

# What docker image should be used for rendering?
# The default is jhudsl/base_ottr:main
rendering-docker-image: 'jhudsl/base_ottr:main'
9 changes: 9 additions & 0 deletions test-rmd_web/index.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "**Test Rmd Website**"
output:
html_document
---

### **About**

This is a test of rendering an Rmd for a website using the ottr-preview action. Changes to the action may mean that there will be no docx file listed in the PR/preview comment hopefully. Should consider adding this testweb stuff for rmd_web as a clean PR possibly?
27 changes: 27 additions & 0 deletions test-rmd_web/resources/dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cheatsheet
css
custimization
cwrigh
Dockerfile
Dockerhub
favicon
GH
Github
GitHub
HTTPS
ITN
ITCR
lightblue
lightgreen
OTTR
Rmd
repo
subdir
th
tibble
www
automations
Bootstap
glyphicons
repo
RStudio
8 changes: 8 additions & 0 deletions test-rmd_web/resources/exclude_files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
About.Rmd
docs/*
style-sets/*
manuscript/*
CONTRIBUTING.md
LICENSE.md
code_of_conduct.md
README.md
2 changes: 2 additions & 0 deletions test-rmd_web/resources/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<link rel="shortcut icon" href="resources/images/favicon.ico" />
<!--- go to https://favicon.io/favicon-converter/ to upload an image to make a new favicon.io. You will need to replace the current favicon.io image with the one in the downloaded directory from the website. The current image is in the resources/images/ directory --->
2 changes: 2 additions & 0 deletions test-rmd_web/resources/ignore-urls.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
username.github.io/repository_name
https://username.github.io/repository_name/
Binary file added test-rmd_web/resources/images/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions test-rmd_web/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

/* To add some space below the navigation bar */

body {
margin-top: 100px;
}


/* add some color - if you want color behind a major point on your website */

.banner_color {
background-color: lightblue;
font-weight:bold;

}

/* Style buttons - if you want some text centered and bolded */

.center {
font-weight:bold;
text-align: center;
}

/* Style buttons - if you want to have a button */
.btn {
background-color: DodgerBlue;
border: none;
color: white;
padding: 8px 20px;
cursor: pointer;
font-size: 14px;
}

/* Darker background on mouse-over */
.btn:hover {
background-color: RoyalBlue;
}