diff --git a/.github/workflows/check-url-2.yml b/.github/workflows/check-url-2.yml
new file mode 100644
index 0000000..1ff5987
--- /dev/null
+++ b/.github/workflows/check-url-2.yml
@@ -0,0 +1,121 @@
+name: Periodic URL Check 2
+
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '0 0 1 * *'
+
+jobs:
+ set-up:
+ name: Load user automation choices
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ # Use the yaml-env-action action.
+ - name: Load environment from YAML
+ uses: doughepi/yaml-env-action@v1.0.0
+ with:
+ files: config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence.
+ outputs:
+ toggle_url_check_periodically: "${{ env.URL_CHECK_PERIODICALLY }}"
+
+ url-check:
+ name: Check URLs
+ needs: set-up
+ if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'true'}}
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ # Delete the branch if this has been run before
+ - name: Delete branch locally and remotely
+ run: git push origin --delete preview-spell-error || echo "No branch to delete"
+
+ # Make the branch fresh
+ - name: Make the branch fresh
+ run: |
+ git config --global --add safe.directory $GITHUB_WORKSPACE
+ git config --global user.name 'github-actions[bot]'
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
+
+ echo branch doesnt exist
+ git checkout -b preview-spell-error || echo branch exists
+ git push --set-upstream origin preview-spell-error || echo echo branch exists remotely
+ shell: bash
+
+ - name: Run the check
+ uses: ottrproject/ottr-reports@main
+ id: check_results
+ continue-on-error: true
+ with:
+ check_spelling: false
+ spelling_error_min: 1
+ check_urls: true
+ url_error_min: 1
+ check_quiz_form: false
+ quiz_error_min: 1
+ sort_dictionary: false
+
+ - name: Declare file path and time
+ id: check-report
+ run: |
+ error_num=$(cat check_reports/url_checks.tsv | wc -l)
+ error_num="$((error_num-1))"
+ echo "error_num=$error_num" >> $GITHUB_OUTPUT
+ echo "error_url=https://github.com/${GITHUB_REPOSITORY}/blob/preview-spell-error/check_reports/url_checks.tsv" >> $GITHUB_OUTPUT
+ shell: bash
+
+ - name: Stop if failure
+ if: steps.check_results.outcome == 'failure'
+ run: exit 1
+
+ - name: Print out error variables
+ run: |
+ echo ${{ steps.check-report.outputs.error_url }}
+ echo ${{ steps.check-report.outputs.error_num }}
+
+ # Commit file
+ - name: Commit tocless bookdown files
+ if: ${{ steps.check-report.outputs.error_num >= 1 }}
+ env:
+ GH_PAT: ${{ secrets.GH_PAT }}
+ run: |
+ git add --force check_reports/url_checks.tsv
+ git commit -m 'Add spell check file' || echo "No changes to commit"
+ git push --set-upstream origin preview-spell-error || echo echo branch exists remotely
+
+ - name: Find issues
+ id: find-issue
+ env:
+ GH_PAT: ${{ secrets.GH_PAT }}
+ run: |
+ echo "$GITHUB_REPOSITORY"
+ curl -o find_issue.R https://raw.githubusercontent.com/ottrproject/ottr-reports/main/scripts/find_issue.R
+ issue_exists=$(Rscript --vanilla find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
+ echo URL issue exists: $issue_exists
+ echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT
+
+ - name: If too many URL errors, then make an issue
+ if: ${{ steps.check-report.outputs.error_num >= 1 && steps.find-issue.outputs.issue_existence == 0}}
+ uses: JasonEtco/create-an-issue@v2
+ with:
+ filename: .github/ISSUE_TEMPLATE/url-error.md
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ FILE_URL: ${{ steps.check-report.outputs.error_url }}
+ ERROR_NUM: ${{ steps.check-report.outputs.error_num }}
+
+ - name: If no URL errors than delete the branch we made
+ if: ${{ steps.check-report.outputs.error_num < 1 }}
+ run: |
+ git config --system --add safe.directory "$GITHUB_WORKSPACE"
+ git push origin --delete preview-spell-error || echo "No branch to delete"
diff --git a/.github/workflows/check-url.yml b/.github/workflows/check-url.yml
index 090f12f..6cfef1a 100644
--- a/.github/workflows/check-url.yml
+++ b/.github/workflows/check-url.yml
@@ -26,7 +26,7 @@ jobs:
url-check:
name: Check URLs
needs: set-up
- if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'yes'}}
+ if: ${{needs.set-up.outputs.toggle_url_check_periodically == 'true'}}
runs-on: ubuntu-latest
container:
image: jhudsl/base_ottr:main
@@ -54,12 +54,17 @@ jobs:
shell: bash
- name: Run the check
- uses: jhudsl/ottr-reports@main
+ uses: ottrproject/ottr-reports@main
id: check_results
continue-on-error: true
with:
- check_type: urls
- error_min: 1
+ check_spelling: false
+ spelling_error_min: 1
+ check_urls: true
+ url_error_min: 1
+ check_quiz_form: false
+ quiz_error_min: 1
+ sort_dictionary: false
- name: Declare file path and time
id: check-report
@@ -78,7 +83,7 @@ jobs:
run: |
echo ${{ steps.check-report.outputs.error_url }}
echo ${{ steps.check-report.outputs.error_num }}
-
+
# Commit file
- name: Commit tocless bookdown files
if: ${{ steps.check-report.outputs.error_num >= 1 }}
@@ -95,7 +100,7 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
echo "$GITHUB_REPOSITORY"
- curl -o find_issue.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/find_issue.R
+ curl -o find_issue.R https://raw.githubusercontent.com/ottrproject/ottr-reports/main/scripts/find_issue.R
issue_exists=$(Rscript --vanilla find_issue.R --repo $GITHUB_REPOSITORY --git_pat $GH_PAT)
echo URL issue exists: $issue_exists
echo "issue_existence=$issue_exists" >> $GITHUB_OUTPUT
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 091af95..9b3ece7 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -1,5 +1,5 @@
# Candace Savonen 2021
-# Updated May 2024
+# Updated May 2025
name: Pull Request
@@ -45,57 +45,51 @@ jobs:
outputs:
toggle_website: "${{ env.RENDER_WEBSITE }}"
toggle_spell_check: "${{ env.SPELL_CHECK }}"
+ spell_error_min: "${{ env.SPELL_ERROR_MIN }}"
toggle_style_code: "${{ env.STYLE_CODE }}"
toggle_url_check: "${{ env.URL_CHECKER }}"
+ url_error_min: "${{ env.URL_ERROR_MIN }}"
toggle_quiz_check: "${{ env.CHECK_QUIZZES }}"
+ quiz_error_min: "${{ env.QUIZ_ERROR_MIN }}"
toggle_md_linter: "${{ env.MARKDOWN_LINTER }}"
toggle_readability: "${{ env.READABILITY_REPORT }}"
toggle_render_preview: "${{ env.RENDER_PREVIEW }}"
+ toggle_dictionary_sort: "${{ env.DICTIONARY_SORT }}"
rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}"
########################## Make the error reports ##############################
- spell-check:
- name: Check spelling
+ ottr-reports:
+ name: Run Reports
needs: yaml-check
- if: ${{needs.yaml-check.outputs.toggle_spell_check == 'yes'}}
- uses: jhudsl/ottr-reports/.github/workflows/report-maker.yml@main
- with:
- check_type: spelling
- error_min: 3
- branch_name: ${GITHUB_HEAD_REF}
- secrets:
- gh_pat: ${{ secrets.GH_PAT }}
-
- url-check:
- name: Check URLs
- needs: yaml-check
- if: ${{needs.yaml-check.outputs.toggle_url_check == 'yes'}}
- uses: jhudsl/ottr-reports/.github/workflows/report-maker.yml@main
- with:
- check_type: urls
- error_min: 0
- branch_name: ${GITHUB_HEAD_REF}
- secrets:
- gh_pat: ${{ secrets.GH_PAT }}
+ if: ${{needs.yaml-check.outputs.toggle_spell_check == 'true' || needs.yaml-check.outputs.toggle_url_check == 'true' || needs.yaml-check.outputs.toggle_quiz_check == 'true'}}
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
- quiz-check:
- name: Check quiz formatting
- if: ${{needs.yaml-check.outputs.toggle_quiz_check == 'yes'}}
- needs: yaml-check
- uses: jhudsl/ottr-reports/.github/workflows/report-maker.yml@main
- with:
- check_type: quiz_format
- error_min: 0
- branch_name: ${GITHUB_HEAD_REF}
- secrets:
- gh_pat: ${{ secrets.GH_PAT }}
+ steps:
+ - name: Checkout Actions Repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Run Reports
+ id: run-reports
+ uses: ottrproject/ottr-reports@main
+ with:
+ check_spelling: ${{needs.yaml-check.outputs.toggle_spell_check}}
+ spelling_error_min: ${{needs.yaml-check.outputs.spell_error_min}}
+ check_urls: ${{needs.yaml-check.outputs.toggle_url_check}}
+ url_error_min: ${{needs.yaml-check.outputs.url_error_min}}
+ check_quiz_form: ${{needs.yaml-check.outputs.toggle_quiz_check}}
+ quiz_error_min: ${{needs.yaml-check.outputs.quiz_error_min}}
+ sort_dictionary: ${{needs.yaml-check.outputs.toggle_dictionary_sort}}
############################# Style the code ###################################
style-code:
name: Style code
needs: yaml-check
runs-on: ubuntu-latest
- if: ${{needs.yaml-check.outputs.toggle_style_code == 'yes'}}
+ if: ${{needs.yaml-check.outputs.toggle_style_code == 'true'}}
container:
image: jhudsl/base_ottr:main
@@ -121,7 +115,7 @@ jobs:
name: Readability report
needs: yaml-check
runs-on: ubuntu-latest
- if: ${{needs.yaml-check.outputs.toggle_readability == 'yes'}}
+ if: ${{needs.yaml-check.outputs.toggle_readability == 'true'}}
steps:
- name: Checkout repo
@@ -136,127 +130,23 @@ jobs:
glob: '**/*.md'
############################# Render Preview ###################################
-
render-preview:
name: Render preview
needs: yaml-check
runs-on: ubuntu-latest
- container:
- image: ${{needs.yaml-check.outputs.rendering_docker_image}}
- if: ${{needs.yaml-check.outputs.toggle_render_preview == 'yes'}}
+ if: ${{needs.yaml-check.outputs.toggle_render_preview == 'true'}}
+ permissions:
+ pull-requests: write
+ contents: write
steps:
- - name: Checkout files
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- # Set up git checkout
- - name: Set up git checkout
- run: |
- git config --global --add safe.directory $GITHUB_WORKSPACE
- git config --global user.name 'github-actions[bot]'
- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
-
- branch_name='preview-${{ github.event.pull_request.number }}'
- git fetch --all
- git checkout $branch_name
- git merge -s recursive --strategy-option=theirs origin/${{ github.head_ref }} --allow-unrelated-histories
- shell: bash
-
- # Run bookdown rendering
- - name: Run bookdown render
- id: bookdown
- if: ${{needs.yaml-check.outputs.toggle_website == 'rmd' }}
- run: Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')"
-
- # Run quarto rendering
- - name: Render quarto version
- id: quarto
- if: ${{needs.yaml-check.outputs.toggle_website == 'quarto' }}
- run: Rscript -e "quarto::quarto_render('.')"
-
- # 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 Rmd render steps
- if: ${{needs.yaml-check.outputs.toggle_website == 'rmd' }}
- run: |
- echo Bookdown status ${{steps.bookdown.outcome}}
- if [${{steps.bookdown.outcome}} != 'success']; then
- exit 1
- fi
-
- - name: Check on quarto render steps
- if: ${{needs.yaml-check.outputs.toggle_website == 'quarto' }}
- run: |
- echo Quarto status ${{steps.quarto.outcome}}
- if [${{steps.quarto.outcome}} != 'success']; then
- exit 1
- fi
-
- - name: Website preview for download
- run: zip website-preview.zip docs/* -r
-
- # Commit the rendered bookdown files
- - name: Commit rendered bookdown files to preview branch
- id: commit
- run: |
- branch_name='preview-${{ github.event.pull_request.number }}'
- git diff origin/main -- docs >/dev/null && changes=true || changes=false
- echo "changes=$changes" >> $GITHUB_OUTPUT
- git add . --force
- git commit -m 'Render preview' || echo "No changes to commit"
- git pull --rebase --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours
- git push --force || echo "No changes to commit"
- shell: bash
-
- - name: Find Comment
- uses: peter-evans/find-comment@v2
- id: fc
- with:
- issue-number: ${{ github.event.pull_request.number }}
- comment-author: 'github-actions[bot]'
- 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")
- docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/docs/$course_name.docx")
- zip_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/website-preview.zip")
- echo "zip_link=$zip_link" >> $GITHUB_OUTPUT
- echo "bookdown_link=$bookdown_link" >> $GITHUB_OUTPUT
- echo "docx_link=$docx_link" >> $GITHUB_OUTPUT
- echo "time=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- echo "commit_id=$GITHUB_SHA" >> $GITHUB_OUTPUT
- echo ${{steps.commit.outputs.changes}}
-
- - name: Create or update comment
- if: steps.commit.outputs.changes == 'true'
- 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 }})
- - Download the [.docx file](${{ steps.build-components.outputs.docx_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: steps.commit.outputs.changes == 'false'
- uses: peter-evans/create-or-update-comment@v2
- 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
+ - name: Checkout repo
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Run render
+ uses: ottrproject/ottr-preview@main
+ with:
+ toggle_website: ${{needs.yaml-check.outputs.toggle_website}}
+ docker_image: ${{needs.yaml-check.outputs.rendering_docker_image}}
diff --git a/.github/workflows/render-all.yml b/.github/workflows/render-all.yml
index 56dffb7..e404e09 100644
--- a/.github/workflows/render-all.yml
+++ b/.github/workflows/render-all.yml
@@ -1,5 +1,5 @@
# Candace Savonen 2021
-# Updated May 2024
+# Updated April 2025
name: Render all output courses
@@ -39,8 +39,6 @@ jobs:
name: Render course preview
needs: yaml-check
runs-on: ubuntu-latest
- container:
- image: ${{needs.yaml-check.outputs.rendering_docker_image}}
steps:
- name: checkout
@@ -49,60 +47,14 @@ jobs:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- - name: Login as github actions bot
- run: |
- git config --global --add safe.directory $GITHUB_WORKSPACE
- git config --global user.name 'github-actions[bot]'
- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
-
- # We want a fresh run of the renders each time
- - name: Delete old docs/*
- run: |
- git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
- git fetch origin
- git pull --rebase --allow-unrelated-histories --strategy-option=ours
-
- # Run Rmd rendering
- - name: Run bookdown render
- id: bookdown
- if: ${{needs.yaml-check.outputs.toggle_website == 'rmd' }}
- run: |
- rm -rf docs/*
- Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all');
- file.copy(from = 'assets', to = 'docs/assets', overwrite = TRUE)"
-
- - name: Render quarto version
- id: quarto
- if: ${{needs.yaml-check.outputs.toggle_website == 'quarto' }}
- run: Rscript -e "quarto::quarto_render('.')"
-
- # 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 Rmd render steps
- if: ${{needs.yaml-check.outputs.toggle_website == 'rmd' }}
- run: |
- echo Bookdown status ${{steps.bookdown.outcome}}
- if [${{steps.bookdown.outcome}} != 'success']; then
- exit 1
- fi
-
- - name: Check on quarto render steps
- if: ${{needs.yaml-check.outputs.toggle_website == 'quarto' }}
- run: |
- echo Quarto status ${{steps.quarto.outcome}}
- if [${{steps.quarto.outcome}} != 'success']; then
- exit 1
- fi
-
- # Commit the rendered course files
- - name: Commit rendered course files
- env:
- GH_PAT: ${{ secrets.GH_PAT }}
- run: |
- git add --force docs/*
- git commit -m 'Render course' || echo "No changes to commit"
- git status docs/*
- git push --force -u origin main || echo "No changes to push"
+ - name: Run render
+ id: render
+ uses: ottrproject/ottr-preview@main
+ with:
+ toggle_website: ${{needs.yaml-check.outputs.toggle_website}}
+ preview: false
+ token: ${{ secrets.GH_PAT }}
+ docker_image: ${{needs.yaml-check.outputs.rendering_docker_image}}
render-tocless:
name: Render TOC-less version for Leanpub or Coursera
@@ -110,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
- if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes' || needs.yaml-check.outputs.toggle_leanpub == 'yes'}}
+ if: ${{needs.yaml-check.outputs.toggle_coursera == 'true' || needs.yaml-check.outputs.toggle_leanpub == 'true'}}
steps:
- name: checkout
@@ -157,8 +109,8 @@ jobs:
needs: [yaml-check, render-tocless]
runs-on: ubuntu-latest
container:
- image: jhudsl/ottrpal
- if: ${{needs.yaml-check.outputs.toggle_leanpub == 'yes'}}
+ image: jhudsl/base_ottr:dev
+ if: ${{needs.yaml-check.outputs.toggle_leanpub == 'true'}}
steps:
- name: checkout
@@ -184,12 +136,12 @@ jobs:
rm -rf resources/chapt_screen_images
# Make new screenshots
- curl -o make_screenshots.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/make_screenshots.R
- chapt_urls=$(Rscript --vanilla make_screenshots.R \
- --git_pat ${{ secrets.GH_PAT }} \
- --repo $GITHUB_REPOSITORY \
- --output_dir resources/chapt_screen_images)
- rm make_screenshots.R
+ chapt_urls=$(Rscript -e " \
+ Sys.setenv(CHROMOTE_CHROME = '/usr/bin/vivaldi'); \
+ ottrpal::make_screenshots( \
+ token = '${{ secrets.GH_PAT }}', \
+ repo = '$GITHUB_REPOSITORY' )" \
+ )
# We want a fresh run of the renders each time
- name: Delete manuscript/
@@ -201,34 +153,31 @@ jobs:
git commit -m 'Delete manuscript folder' || echo "No changes to commit"
git push -u origin main || echo "No changes to push"
- - name: Run ottrpal::bookdown_to_embed_leanpub
- if: ${{ needs.yaml-check.outputs.toggle_quiz_check == 'no'}}
+ - name: Run ottrpal::bookdown_to_embed_leanpub -- No Quiz
+ if: ${{ needs.yaml-check.outputs.toggle_quiz_check != 'true'}}
run: |
- echo needs.yaml-check.outputs.toggle_make_book_txt == 'yes'
- echo needs.yaml-check.outputs.toggle_make_book_txt
- Rscript -e "ottrpal::bookdown_to_embed_leanpub(
+ Rscript -e "ottrpal::website_to_embed_leanpub(
render = FALSE, \
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
- make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt == 'yes'}}'), \
+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt == 'true'}}'), \
quiz_dir = NULL)"
- - name: Run ottrpal::bookdown_to_embed_leanpub
- if: ${{ needs.yaml-check.outputs.toggle_quiz_check == 'yes'}}
+ - name: Run ottrpal::bookdown_to_embed_leanpub -- with Quiz
+ if: ${{ needs.yaml-check.outputs.toggle_quiz_check == 'true'}}
run: |
- Rscript -e "ottrpal::bookdown_to_embed_leanpub(
+ Rscript -e "ottrpal::website_to_embed_leanpub(
render = FALSE, \
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
- make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt == 'yes'}}'))"
+ make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt == 'true'}}'))"
# Commit the rendered Leanpub files
- name: Commit rendered Leanpub files
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
- mkdir -p manuscript
- git add --force manuscript/*
- git add --force resources/*
- git add --force docs/*
+ git add --force manuscript/* || "No files to add"
+ git add --force resources/* || "No files to add"
+ git add --force docs/* || "No files to add"
git commit -m 'Render Leanpub' || echo "No changes to commit"
git status docs/*
git pull --rebase --allow-unrelated-histories --strategy-option=ours --autostash
@@ -240,7 +189,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: ${{needs.yaml-check.outputs.rendering_docker_image}}
- if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes'}}
+ if: ${{needs.yaml-check.outputs.toggle_coursera == 'true'}}
steps:
- name: checkout
@@ -260,7 +209,7 @@ jobs:
# Run Coursera version
- name: Convert Leanpub quizzes to Coursera
- if: needs.yaml-check.outputs.toggle_leanpub == 'yes' && needs.yaml-check.outputs.toggle_quiz_check == 'yes'
+ if: needs.yaml-check.outputs.toggle_leanpub == 'true' && needs.yaml-check.outputs.toggle_quiz_check == 'true'
id: coursera
run: Rscript -e "ottrpal::convert_coursera_quizzes()"
@@ -273,7 +222,6 @@ jobs:
if [ -d 'coursera_quizzes' ]; then
git add --force coursera_quizzes/*
fi
- git add --force manuscript/*
git add --force resources/*
git add --force docs/*
git commit -m 'Render Coursera quizzes' || echo "No changes to commit"
diff --git a/05-scientific-notebooks.Rmd b/05-scientific-notebooks.Rmd
index 66287d5..34162ce 100644
--- a/05-scientific-notebooks.Rmd
+++ b/05-scientific-notebooks.Rmd
@@ -152,7 +152,7 @@ From @Shapiro2021
More reading about RStudio's interface:
- [RStudio IDE Cheatsheet (pdf)](https://rstudio.github.io/cheatsheets/html/rstudio-ide.html).
-- [Navigating the RStudio Interface - R for Epidemiology](https://www.r4epi.com/navigating-the-rstudio-interface.html)
+- [Navigating the RStudio Interface - R for Epidemiology](https://www.r4epi.com/chapters/navigating_rstudio/navigating_rstudio)
diff --git a/07-durable-code.Rmd b/07-durable-code.Rmd
index e8a88cb..9e79248 100644
--- a/07-durable-code.Rmd
+++ b/07-durable-code.Rmd
@@ -44,7 +44,7 @@ We'll talk a bit more about code review in an upcoming chapter!
- [Readable Code](https://blog.pragmaticengineer.com/readable-code/) by @Orosz2019.
- [Write clean R code](https://appsilon.com/write-clean-r-code/) by @Dubel2021.
-- [Python Clean Code: 6 Best Practices to Make Your Python Functions More Readable](https://towardsdatascience.com/python-clean-code-6-best-practices-to-make-your-python-functions-more-readable-7ea4c6171d60) by @Tran2021.
+- [Python Clean Code: 6 Best Practices to Make Your Python Functions More Readable](https://medium.com/data-science/python-clean-code-6-best-practices-to-make-your-python-functions-more-readable-7ea4c6171d60) by @Tran2021.
#### DRY up your code
@@ -191,8 +191,8 @@ Try to avoid using variable names that have no meaning like `tmp` or `x`, or `i`
**More reading:**
-- [R for Epidemiology - Coding best Practices](https://www.r4epi.com/coding-best-practices.html#object-variable-names) by @Cannell2021.
-- [Data Scientists: Your Variable Names Are Awful. Here’s How to Fix Them](https://towardsdatascience.com/data-scientists-your-variable-names-are-awful-heres-how-to-fix-them-89053d2855be) by @Koehrsen2019.
+- [R for Epidemiology - Coding best Practices](https://www.r4epi.com/chapters/best_practices/best_practices#object-variable-names) by @Cannell2021.
+- [Data Scientists: Your Variable Names Are Awful. Here’s How to Fix Them](https://willkoehrsen.github.io/data%20science/software%20engineering/data-scientists-your-variable-names-are-awful-heres-how-to-fix-them/) by @Koehrsen2019.
- [Writing Variable — Informative, Descriptive & Elegant](https://medium.datadriveninvestor.com/writing-variable-informative-descriptive-elegant-1dd6f3f15db3) by @Hobert2018.
#### Follow a code style
@@ -301,7 +301,7 @@ There's so many opinions and strategies on best practices for code. And although
- [Data Carpentry's: Best Practices for Writing R Code](https://swcarpentry.github.io/r-novice-inflammation/06-best-practices-R.html) by @DataCarpentry2021b.
- [R Programming for Research: Reproducible Research](https://geanders.github.io/RProgrammingForResearch/reproducible-research-1.html) by @Good2021.
-- [R for Epidemiology: Coding best practices](https://www.r4epi.com/coding-best-practices.html) by @Cannell2021.
+- [R for Epidemiology: Coding best practices](https://www.r4epi.com/chapters/best_practices/best_practices) by @Cannell2021.
- [Best practices for R Programming](https://towardsdatascience.com/best-practices-for-r-programming-ec0754010b5a) by @Bernardo2021.
## Get the exercise project files (or continue with the files you used in the previous chapter)
diff --git a/08-readmes.Rmd b/08-readmes.Rmd
index 7dd0d66..8d645a5 100644
--- a/08-readmes.Rmd
+++ b/08-readmes.Rmd
@@ -67,7 +67,7 @@ You can take a look at this [template README](https://raw.githubusercontent.com/
- [How to write a good README file](https://www.freecodecamp.org/news/how-to-write-a-good-readme-file/)
- [A Beginners Guide to writing a Kicka** README](https://meakaakka.medium.com/a-beginners-guide-to-writing-a-kickass-readme-7ac01da88ab3)
-- [How to write an awesome README](https://towardsdatascience.com/how-to-write-an-awesome-readme-68bf4be91f8b)
+- [Tips for Creating Great README Docs](https://www.archbee.com/blog/readme-creating-tips)
## Get the exercise project files (or continue with the files you used in the previous chapter)
diff --git a/assets/style.css b/assets/style.css
new file mode 100755
index 0000000..587dd94
--- /dev/null
+++ b/assets/style.css
@@ -0,0 +1,441 @@
+/* variables are set in style_config_default.css */
+
+@import url('https://fonts.googleapis.com/css?family=Abril+Fatface|Karla:400,400i,700,700i|Lora:400,400i,700,700i&display=swap');
+
+p.caption {
+ color: var(--caption-color);
+ margin-top: 10px;
+}
+p code {
+ white-space: inherit;
+}
+pre {
+ word-break: normal;
+ word-wrap: normal;
+}
+pre code {
+ white-space: inherit;
+}
+
+/*---------------Hero Image------------------*/
+
+/* next 3 rules are for setting large image at top of each page and pushing down the book content to appear beneath the image */
+
+.hero-image-container {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 200px;
+ /*background-image: url("images/books.jpg");*/
+ /*background-color: #193a5c;*/
+}
+
+.hero-image {
+ width: 100%;
+ height: 80%;
+ /*object-fit: cover;*/
+}
+
+.page-inner {
+ padding-top: 140px !important;
+}
+
+
+/* ------------Links------------------ */
+
+.book .book-body .page-wrapper .page-inner section.normal a {
+ color: var(--link-color);
+ text-decoration: underline;
+}
+
+
+/*------------- Body and header text---------------- */
+
+.book.font-family-1 {
+ font-family: 'Karla', arial, sans-serif;
+}
+
+h1, h2, h3, h4 {
+ font-family: 'Lora', arial, sans-serif;
+}
+
+
+.book .book-body .page-wrapper .page-inner section.normal h1,
+.book .book-body .page-wrapper .page-inner section.normal h2,
+.book .book-body .page-wrapper .page-inner section.normal h3,
+.book .book-body .page-wrapper .page-inner section.normal h4,
+.book .book-body .page-wrapper .page-inner section.normal h5,
+.book .book-body .page-wrapper .page-inner section.normal h6 {
+ margin-top: 2.275em;
+ margin-bottom: 1em;
+}
+
+.title {
+ font-family: 'Lora';
+ font-size: 4em !important;
+ color: var(--accent-color);
+ margin-top: 0.275em !important;
+ margin-bottom: 0.35em !important;
+}
+
+.subtitle {
+ font-family: 'Lora';
+ color: var(--link-color);
+}
+
+
+/*----------DROP CAPS--------------*/
+
+
+/*p:nth-child(2):first-letter { /* /* DROP-CAP FOR FIRST P BENEATH EACH H1 OR H2*/ /*
+ color: #3fb5bd;
+ float: left;
+ font-family: 'Abril Fatface', serif;
+ font-size: 7em;
+ line-height: 65px;
+ padding-top: 4px;
+ padding-right: 8px;
+ padding-left: 3px;
+ margin-bottom: 9px;
+}
+*/
+
+.section.level1 > p:first-of-type:first-letter { /*drop cap for first p beneath level 1 headers only within class .section*/
+ color: var(--accent-color);
+ float: left;
+ font-family: 'Abril Fatface', serif;
+ font-size: 7em;
+ line-height: 65px;
+ padding-top: 4px;
+ padding-right: 8px;
+ padding-left: 3px;
+ margin-bottom: 9px;
+}
+
+/* add drop cap to first paragraph that follows the first 2nd level header*/
+/*
+.section.level2:first-of-type > p:first-of-type:first-letter {
+ color: #3fb5bd;
+ float: left;
+ font-family: 'Abril Fatface', serif;
+ font-size: 7em;
+ line-height: 65px;
+ padding-top: 4px;
+ padding-right: 8px;
+ padding-left: 3px;
+ margin-bottom: 9px;
+}
+*/
+
+
+
+/*------------ TOC --------------*/
+
+
+.book .book-summary {
+ background: var(--background-color);
+ border-right: none;
+}
+
+/*---color of links in TOC----*/
+
+.book .book-summary a {
+color: var(--accent-color)
+}
+
+.summary{
+ font-family: 'Karla', sans-serif;
+}
+
+/* all TOC list items, basically */
+.book .book-summary ul.summary li a,
+.book .book-summary ul.summary li span {
+ padding-top: 8px;
+ padding-bottom: 8px;
+ padding-left: 15px;
+ padding-right: 15px;
+ color: var(--accent-color);
+}
+
+.summary a:hover {
+ color: var(--highlight-color) !important;
+}
+
+.book .book-summary ul.summary li.active>a { /*active TOC links*/
+ color: var(--link-color) !important;
+ border-left: solid 4px;
+ border-color: var(--highlight-color);
+ padding-left: 11px !important;
+}
+
+
+li.appendix span, li.part span { /* for TOC part names */
+ margin-top: 1em;
+ color: #000000;
+ opacity: .9 !important;
+ text-transform: uppercase;
+}
+
+.part + li[data-level=""] { /* grabs first .chapter immediately after .part...but only those ch without numbers */
+ text-transform: uppercase;
+}
+
+
+/* The next two rules make the horizontal line go straight across in top navbar */
+
+.summary > li:first-child {
+ height: 50px;
+ padding-top: 10px;
+ border-bottom: 1px solid rgba(0,0,0,.07);
+}
+
+.book .book-summary ul.summary li.divider {
+ height: 0px;
+}
+
+
+/*--- LOGO ---*/
+
+.toc-logo {
+ width: 200px !important;
+ object-fit: contain;
+ margin: 0 auto;
+}
+
+.toc-logo img {
+ max-width: 100%;
+ margin-bottom: 10px;
+}
+
+.summary > li:first-child {
+ height: auto !important;
+}
+
+/* --------------Two columns--------------- */
+
+.col2 {
+ columns: 2 200px; /* number of columns and width in pixels*/
+ -webkit-columns: 2 200px; /* chrome, safari */
+ -moz-columns: 2 200px; /* firefox */
+}
+
+
+.side-by-side {
+ display: flex;
+}
+
+.side1 {
+ width: 40%;
+}
+
+.side2 {
+ width: 58%;
+ margin-left: 1rem;
+}
+
+/* --------------Even split- two columns--------------- */
+
+.split {
+ display: flex;
+}
+
+.split1 {
+ width: 50%;
+ padding-right: 20px;
+}
+
+.split2 {
+ width: 50%;
+}
+
+
+/* Sidebar formating --------------------------------------------*/
+/* from r-pkgs.org*/
+
+div.notice, div.warning, div.github, div.dictionary, div.reflection, div.wip {
+ padding: 1em;
+ margin: 1em 0;
+ padding-left: 100px;
+ min-height: 120px;
+ background-repeat: no-repeat;
+}
+
+div.notice{
+ border: 4px var(--highlight-color);
+ border-style: solid;
+ background-size: 70px;
+ background-position: 15px center;
+ background-color: var(--callout-background-color);
+ background-image: url("../assets/box_images/note.png");
+}
+
+
+div.warning{
+ border: 4px #e0471c;
+ border-style: solid;
+ background-size: 70px;
+ background-position: 15px center;
+ background-color: var(--callout-background-color);
+ background-image: url("../assets/box_images/warning.png");
+}
+
+div.github{
+ border: 4px #000000;
+ border-style: solid;
+ background-size: 70px;
+ background-position: 15px center;
+ background-color: var(--callout-background-color);
+ background-image: url("../assets/box_images/github.png");
+}
+
+div.dictionary{
+ border: 4px var(--highlight-color);
+ border-style: solid;
+ background-size: 70px;
+ background-position: 15px center;
+ background-color: var(--callout-background-color);
+ background-image: url("../assets/box_images/dictionary.png");
+}
+
+div.reflection{
+ border: 4px var(--highlight-color);
+ border-style: solid;
+ background-size: 90px;
+ background-position: 15px center;
+ background-color: var(--callout-background-color);
+ background-image: url("../assets/box_images/thinking_face.png");
+}
+
+div.wip{
+ border: 4px #000000;
+ border-style: solid;
+ background-size: 70px;
+ background-position: 15px center;
+ background-color: #f4d03f;
+ background-image: url("../assets/box_images/under_construction.png");
+}
+
+/* .book .book-body .page-wrapper .page-inner section.normal is needed
+ to override the styles produced by gitbook, which are ridiculously
+ overspecified. Goal of the selectors is to ensure internal "margins"
+ controlled only by padding of container */
+
+.book .book-body .page-wrapper .page-inner section.normal div.rstudio-tip > :first-child,
+.book .book-body .page-wrapper .page-inner section.normal div.tip > :first-child {
+ margin-top: 0;
+}
+
+.book .book-body .page-wrapper .page-inner section.normal div.rstudio-tip > :last-child,
+.book .book-body .page-wrapper .page-inner section.normal div.tip > :last-child {
+ margin-bottom: 0;
+}
+
+iframe {
+ -moz-transform-origin: top left;
+ -webkit-transform-origin: top left;
+ -o-transform-origin: top left;
+ -ms-transform-origin: top left;
+ transform-origin: top left;
+}
+
+.iframe-container {
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+ border: #ddd 2px solid;
+ box-shadow: #888 0px 5px 8px;
+ margin-bottom: 1em;
+}
+
+.iframe-container > iframe {
+ border: none;
+}
+
+
+/* -------Clipboard copy button --------- */
+.copy {
+ width: inherit;
+ background-color: #e2e2e2 ;
+ border: none;
+ border-radius: 2px;
+ float: right;
+ font-size: 60%;
+ padding: 4px 4px 4px 4px;
+}
+
+/* for new copy button */
+
+.hasCopyButton {
+ position: relative;
+}
+
+.btn-copy-ex {
+ position: absolute;
+ right: 0;
+ top: 0;
+ visibility: hidden;
+}
+
+.hasCopyButton:hover button.btn-copy-ex {
+ visibility: visible;
+}
+
+
+
+/* -----------Section anchors -------------*/
+
+.book .book-body .page-wrapper .page-inner section.normal {
+ overflow: visible !important; /*so anchor link doesn't get cut off */
+}
+
+a.anchor {
+ margin-left: -30px;
+ padding-right: 3px;
+ display:inline-block;
+ width: 30px;
+ height: 30px;
+ /*visibility: hidden;*/
+ background-image: url(https://image.flaticon.com/icons/svg/34/34735.svg) !important;
+ background-repeat: no-repeat !important;
+ background-size: 20px 20px !important;
+ background-position: center bottom !important;
+ opacity: 0;
+}
+
+
+.hasAnchor:hover a.anchor,
+a.anchor:hover {
+ /*visibility: visible;*/
+ opacity: 0.6;
+}
+
+/* disable anchors for headers with "no-anchor" class */
+.no-anchor .hasAnchor:hover a.anchor,
+.no-anchor a.anchor:hover {
+ opacity: 0 !important;
+}
+
+@media (max-width: 1144px) { /* don't show anchor link on small screens */
+ .hasAnchor:hover a.anchor {
+ visibility: hidden;
+ }
+}
+
+
+/*____Code Chunks____*/
+
+.sourceCode {
+ margin-bottom: 0.85em; /* adds same amount of margin as a
would */ +} + +.sourceCode pre { + margin: 0 !important; /* makes space above and below symmetrical*/ +} + +/* Footer */ + +.footer { + font-family: "Lora", serif; + font-size: .85em; + color: var(--accent-color); +} diff --git a/assets/style_config_default.css b/assets/style_config_default.css new file mode 100644 index 0000000..1c7f4bd --- /dev/null +++ b/assets/style_config_default.css @@ -0,0 +1,8 @@ +:root { + --link-color: #0b5b9d; + --accent-color: #012d72; /* book title, first letter of chapter, toc text */ + --highlight-color: #68ace5; /* toc highlight, callout box borders */ + --caption-color: #595959; + --background-color: white; + --callout-background-color: #e8ebee; + } \ No newline at end of file diff --git a/book.bib b/book.bib index fd346c8..4430659 100644 --- a/book.bib +++ b/book.bib @@ -135,7 +135,7 @@ @website{Bryan2021 @book{Cannell2021, title = {9 {Coding} best practices {\textbar} {R} for {Epidemiology}}, - url = {https://brad-cannell.github.io/r4epi/}, + url = {https://www.r4epi.com/}, abstract = {This is the textbook for Brad Cannell’s Introduction to R Programming for Epidemiologic Research course.}, urldate = {2021-11-02}, author = {Cannell, Brad}, @@ -548,7 +548,7 @@ @misc{Kostyuk2020 @misc{Koehrsen2019, title = {Data {Scientists}: {Your} {Variable} {Names} {Are} {Awful}. {Here}’s {How} to {Fix} {Them}.}, shorttitle = {Data {Scientists}}, - url = {https://towardsdatascience.com/data-scientists-your-variable-names-are-awful-heres-how-to-fix-them-89053d2855be}, + url = {https://willkoehrsen.github.io/data%20science/software%20engineering/data-scientists-your-variable-names-are-awful-heres-how-to-fix-them/}, abstract = {A Simple Way to Greatly Improve Code Quality}, language = {en}, urldate = {2021-10-29}, @@ -919,7 +919,7 @@ @misc{Tidyverse2021 @misc{Tran2021, title = {Python {Clean} {Code}: 6 {Best} {Practices} to {Make} your {Python} {Functions} more {Readable}}, shorttitle = {Python {Clean} {Code}}, - url = {https://towardsdatascience.com/python-clean-code-6-best-practices-to-make-your-python-functions-more-readable-7ea4c6171d60}, + url = {https://medium.com/data-science/python-clean-code-6-best-practices-to-make-your-python-functions-more-readable-7ea4c6171d60}, abstract = {Stop Writing Python Functions that Take more than 3 Minutes to Understand}, language = {en}, urldate = {2021-11-05}, diff --git a/config_automation.yml b/config_automation.yml index bcbe613..3c7941e 100644 --- a/config_automation.yml +++ b/config_automation.yml @@ -1,33 +1,39 @@ +### Render preview of content with changes (Rmd's and md's are checked) +render-preview: true + ##### Checks run at pull request ##### # Check quiz formatting -check-quizzes: no +check-quizzes: false +quiz_error_min: 0 # 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 +url-checker: true +url_error_min: 0 # Spell check Rmds and quizzes -spell-check: yes +spell-check: true +spell_error_min: 0 + +#### Other options # Style any R code -style-code: yes +style-code: true # Would you like your markdown files to be checked for formatting -markdown-linter: yes +markdown-linter: true # Would you like a readability report on your markdowns? -readability-report: yes +readability-report: true # Test build the docker image if any docker-relevant files have been changed -docker-test: no +docker-test: false # Should URLs be tested periodically? -url-check-periodically: yes +url-check-periodically: true ##### Renderings run upon merge to main branch ##### # Rendering each platform's content render-website: rmd -render-leanpub: yes -render-coursera: no +render-leanpub: true +render-coursera: true ## Automate the creation of Book.txt file? yes/no ## This is only relevant if render-leanpub is yes, otherwise it will be ignored -make-book-txt: yes +make-book-txt: true # What docker image should be used for rendering? # The default is jhudsl/base_ottr:main diff --git a/resources/dictionary.txt b/resources/dictionary.txt index 83c8cd2..f85a53b 100644 --- a/resources/dictionary.txt +++ b/resources/dictionary.txt @@ -22,6 +22,8 @@ Azacytidine Decitabine DESeq DESeqDataset +else's +functionalized hypomethylating IDH myeloid @@ -62,6 +64,7 @@ llinG Leanpub Ns nTi +png pseudorandomly setwd sp