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

🔄 Synced file(s) with jhudsl/DaSL_Course_Template_Bookdown #5

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/course-content-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: New content idea
about: Suggest an idea for the course
title: ''
labels: ''
assignees: cansavvy
assignees:

---

**Describe the your scope of your content idea**
What will this cover and how does it relate to the current course material?
## Describe the your scope of your content idea
<!-- What will this cover and how does it relate to the current course material? -->

**Describe the learning objectives for your content idea**
What will users learn from this new content?
## Describe the learning objectives for your content idea
<!-- What will users learn from this new content? -->

**Additional context or resources**
Add any other context or related resources we should know about?
## Additional context or resources
<!-- Add any other context or related resources we should know about? -->
25 changes: 13 additions & 12 deletions .github/ISSUE_TEMPLATE/course-problem-report.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
---
name: Course Problem Report
about: Create a report to help improve the course
title: problem
title: [Problem]
labels: bug
assignees: cansavvy
assignees:

---

**Describe what is not working with the course**
A clear and concise description of what the bug is.
## Describe what is not working with the course
<!-- A clear and concise description of what the bug is. -->

**To Reproduce**
Steps to reproduce the behavior:
## Steps to Reproduce
<!-- Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->

**Expected behavior**
A clear and concise description of what you expected to happen.
## Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**
If applicable, add screenshots to help explain your problem.
## Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->

**Additional context**
Add any other context about the problem here.
## Additional context
<!-- Add any other context about the problem here. -->
19 changes: 17 additions & 2 deletions .github/workflows/render-bookdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
branches: [ main ]
paths:
- '**.Rmd'
- docker/Dockerfile
- docker/*
- assets/*
jobs:
# This workflow contains a single job called "build-all"
Expand Down Expand Up @@ -67,17 +67,23 @@ jobs:

###### END OF DOCKER UPDATE CHUNK ##############################################

# We want a fresh run of the renders each time
- name: Delete old docs/*
run: rm -r docs/*

# Run bookdown rendering
- name: Run bookdown render
id: bookdown
run: |
docker run \
--mount type=bind,target=/home/rstudio,source=$PWD \
jhudsl/course_template \
Rscript -e "bookdown::render_book('index.Rmd')"
Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')"

##### If you do not wish to host your course on Coursera, you can delete this section #####
# Run Coursera version
- name: Run Coursera version of render
id: coursera
run: |
docker run \
--mount type=bind,target=/home/rstudio,source=$PWD \
Expand All @@ -86,6 +92,15 @@ jobs:

##### End of Coursera rendering section ########################################

# This checks on the steps before it and makes sure that they completed.
# If the renders didn't complete we don't want to commit the file changes
- name: Check on render steps
if: steps.bookdown.outcome != 'success' || steps.coursera.outcome != 'success'
run: |
echo Bookdown status ${{steps.bookdown.outcome}}
echo Coursera status ${{steps.coursera.outcome}}
exit 1

# Commit the rendered bookdown files
- name: Commit rendered bookdown files
run: |
Expand Down
49 changes: 45 additions & 4 deletions .github/workflows/render-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
pull_request:
branches: [ main ]

permissions: write-all

jobs:
# This workflow contains a single job called "build-all"
build-all:
Expand All @@ -20,20 +22,24 @@ jobs:
with:
# get the full repo
fetch-depth: 0
# use github PAT
token: ${{ secrets.GH_PAT }}

# We want a fresh run of the renders each time
- name: Delete old docs/*
run: rm -r docs/*

# Run bookdown rendering
- name: Run bookdown render
id: bookdown
run: |
docker run \
--mount type=bind,target=/home/rstudio,source=$PWD \
jhudsl/course_template \
Rscript -e "bookdown::render_book('index.Rmd')"
Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')"

##### If you do not wish to host your course on Coursera, you can delete this section #####
# Run Coursera version
- name: Run Coursera version of render
id: coursera
run: |
docker run \
--mount type=bind,target=/home/rstudio,source=$PWD \
Expand All @@ -42,35 +48,57 @@ jobs:

##### End of Coursera rendering section ########################################

# This checks on the steps before it and makes sure that they completed.
# If the renders didn't complete we don't want to commit the file changes
- name: Check on render steps
if: steps.bookdown.outcome != 'success' || steps.coursera.outcome != 'success'
run: |
echo Bookdown status ${{steps.bookdown.outcome}}
echo Coursera status ${{steps.coursera.outcome}}
exit 1

# Commit the rendered bookdown files
- name: Commit rendered bookdown files to development branch
id: commit
run: |
git checkout -b "preview-${{ github.event.pull_request.number }}"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
changes=$(git diff --name-only origin/main -- docs)
git add -A
git commit -m 'Render bookdown preview' || echo "No changes to commit"
git push --force origin "preview-${{ github.event.pull_request.number }}" || echo "No changes to push"

if [[ -n $changes ]]; then
echo ::set-output name=changes::$(echo 'changes')
else
echo ::set-output name=changes::$(echo 'no_changes')
fi

- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Re-rendered
body-includes: latest commit

- name: Build components of the comment
id: build-components
run: |
course_name=$(head -n 1 _bookdown.yml | cut -d'"' -f 2| tr " " "-")
bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
coursera_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/coursera/index.html")
docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/docs/$course_name.docx")
echo ::set-output name=bookdown_link::$bookdown_link
echo ::set-output name=coursera_link::$coursera_link
echo ::set-output name=docx_link::$docx_link
echo ::set-output name=time::$(date +'%Y-%m-%d')
echo ::set-output name=commit_id::$GITHUB_SHA
echo ${{steps.commit.outputs.changes}}

- name: Create or update comment
if: steps.commit.outputs.changes == 'changes'
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
Expand All @@ -79,6 +107,19 @@ jobs:
Re-rendered previews from the latest commit:
- See [preview of Bookdown here](${{ steps.build-components.outputs.bookdown_link }})
- See [preview of Coursera version here](${{ steps.build-components.outputs.coursera_link }})
- Download the [preview of .docx file](${{ steps.build-components.outputs.docx_link }})

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

- name: No comment if no changes
if: steps.commit.outputs.changes == 'no_changes'
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
The latest commit did not produce rendering changes.

_Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_
edit-mode: replace
6 changes: 6 additions & 0 deletions .github/workflows/transfer-rendered-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ jobs:
curl --fail -s ${base_url}/${line} > ${line}
done < "$input"


# Get rid of GA Script spec in output yaml
sed 's/GA_Script.Rhtml,//' _output.yml > output.txt
cat output.txt > _output.yml
rm output.txt

- name: Create PR with rendered docs files
if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }}
uses: peter-evans/create-pull-request@v3
Expand Down
2 changes: 1 addition & 1 deletion code_of_conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the Jeff Leek at [email protected].
reported to Jeff Leek at [email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
3 changes: 2 additions & 1 deletion scripts/spell-check.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ dictionary <- readLines(file.path(root_dir, 'resources', 'dictionary.txt'))
# Add mysterious emoji joining character
dictionary <- c(dictionary, spelling::spell_check_text("⬇️")$word)

# Only declare `.Rmd` files
# Only declare `.Rmd` files but not the ones in the style-sets directory
files <- list.files(pattern = 'Rmd$', recursive = TRUE, full.names = TRUE)
files <- grep("About.Rmd", files, ignore.case = TRUE, invert = TRUE, value = TRUE)
files <- grep("style-sets", files, ignore.case = TRUE, invert = TRUE, value = TRUE)

# Run spell check
sp_errors <- spelling::spell_check_files(files, ignore = dictionary) %>%
Expand Down
16 changes: 16 additions & 0 deletions style-sets/AnVIL/_output.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bookdown::gitbook:
css: assets/style_anvil.css
includes:
before_body: assets/big-image.html
after_body: assets/footer.html
highlight: tango
config:
toc:
collapse: section
before: |
<a href="https://anvilproject.org/"><img src="assets/anvil_logo.png" style="padding-left: 15px; padding-top: 8px;"</a>
after: |
<p style="text-align:center;"> <a href="https://github.com/jhudsl/DaSL_Course_Template_Bookdown" target="blank" > This content was published with</a> <a href="https://bookdown.org/" target="blank"> bookdown by: </a> </p>
<p style="text-align:center;"> <a href="http://jhudatascience.org/"> The Johns Hopkins Data Science Lab </a></p>
<a href="http://jhudatascience.org/"><img src="https://jhudatascience.org/images/dasl.png" style=" width: 80%; filter: grayscale(100%); padding-left: 40px; padding-top: 8px; vertical-align: top "</a>
<p style="text-align:center; font-size: 12px;"> <a href="https://github.com/rstudio4edu/rstudio4edu-book/"> Style adapted from: rstudio4edu-book </a> <a href ="https://creativecommons.org/licenses/by/2.0/"> (CC-BY 2.0) </a></p>
Binary file not shown.
Binary file added style-sets/AnVIL/copy_to_assets/logo-anvil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading