From 78d32d2a851c11bdd9b1f021b726dc58995c1b51 Mon Sep 17 00:00:00 2001 From: jhudsl-robot Date: Fri, 6 Jun 2025 21:06:03 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=94=84=20Synced=20local=20'.github/wo?= =?UTF-8?q?rkflows/'=20with=20remote=20'.github/workflows/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release-renderActionTry2 --- .github/workflows/check-url.yml | 16 +- .github/workflows/docker-build.yml | 79 ------- .github/workflows/docker-test.yml | 1 - .github/workflows/pull_request.yml | 210 ++++++----------- .github/workflows/render-all.yml | 223 ++---------------- .github/workflows/transfer-rendered-files.yml | 117 --------- 6 files changed, 93 insertions(+), 553 deletions(-) delete mode 100644 .github/workflows/docker-build.yml delete mode 100644 .github/workflows/transfer-rendered-files.yml diff --git a/.github/workflows/check-url.yml b/.github/workflows/check-url.yml index a437049..7c1326c 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,7 +54,7 @@ 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: @@ -79,13 +79,23 @@ jobs: echo ${{ steps.check-report.outputs.error_url }} echo ${{ steps.check-report.outputs.error_num }} + # Commit file + - name: Commit spell check file + 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/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/docker-build.yml b/.github/workflows/docker-build.yml deleted file mode 100644 index 4a16964..0000000 --- a/.github/workflows/docker-build.yml +++ /dev/null @@ -1,79 +0,0 @@ -# Candace Savonen Apr 2021 - -name: Build Docker - -on: - workflow_dispatch: - inputs: - dockerhubpush: - description: 'Push to Dockerhub?' - required: true - default: 'false' - tag: - description: 'What tag to use?' - required: true - default: 'none' -jobs: - build-docker: - name: Build Docker image - runs-on: ubuntu-latest - - steps: - - name: checkout repo - uses: actions/checkout@v4 - - - name: Login as jhudsl-robot - run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" - - - name: Don't re-test if this is a sync branch - run: | - echo This was tested on OTTR_Template no need to re-run - - # Set up Docker build - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - # Setup layer cache - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - # Set up Docker build - - name: Set up Docker Build - if: ${{ github.head_ref != 'repo-sync/OTTR_Template/default' }} - uses: docker/setup-buildx-action@v1 - - - name: Get token - run: echo ${{ secrets.GH_PAT }} > docker/git_token.txt - - # Build docker image - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - push: false - load: true - context: docker - file: docker/Dockerfile - tags: jhudsl/base_ottr - - # Login to Dockerhub - - name: Login to DockerHub - if: ${{ github.event.inputs.dockerhubpush != 'false' }} - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # Push the Docker image if set to true from a manual trigger - - name: Push Docker image if manual trigger set to true - if: ${{ github.event.inputs.dockerhubpush != 'false' }} - run: | - docker tag jhudsl/base_ottr:latest jhudsl/base_ottr:$github.event.inputs.tag - docker push jhudsl/base_ottr:$github.event.inputs.tag diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 01cb384..b1cdc47 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -45,7 +45,6 @@ jobs: - name: Login as jhudsl-robot run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" git config --local user.email "itcrtrainingnetwork@gmail.com" git config --local user.name "jhudsl-robot" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 2e122ba..9b3ece7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,5 +1,5 @@ # Candace Savonen 2021 -# Updated Jan 2023 +# Updated May 2025 name: Pull Request @@ -17,7 +17,6 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GH_PAT }} # Use the yaml-env-action action. - name: Load environment from YAML @@ -39,58 +38,58 @@ jobs: branch_name='preview-${{ github.event.pull_request.number }}' echo branch doesnt exist git checkout -b $branch_name || echo branch exists - git push --set-upstream origin $branch_name || echo echo branch exists remotely + git push --set-upstream origin $branch_name || echo branch exists remotely shell: bash 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 - gh_pat: secrets.GH_PAT - branch_name: ${GITHUB_HEAD_REF} - - 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 - gh_pat: secrets.GH_PAT - branch_name: ${GITHUB_HEAD_REF} - - 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 - gh_pat: secrets.GH_PAT - branch_name: ${GITHUB_HEAD_REF} + 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 + + 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 @@ -101,130 +100,53 @@ jobs: fetch-depth: 0 - name: Run styler - run: Rscript -e "styler::style_file(list.files(pattern = 'Rmd$', recursive = TRUE, full.names = TRUE));warnings()" + run: Rscript -e "styler::style_file(list.files(pattern = '(R|q)md$', recursive = FALSE, full.names = TRUE));warnings()" - name: Commit styled files run: | git config --system --add safe.directory "$GITHUB_WORKSPACE" - git add \*.Rmd - git commit -m 'Style Rmds' || echo "No changes to commit" + git add \*md + git commit -m 'Style *mds' || echo "No changes to commit" git push origin || echo "No changes to commit" -############################# Render Preview ################################### +############################# Readability Report ################################### - render-preview: - name: Render preview + readability-report: + name: Readability report 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_readability == 'true'}} steps: - - name: Checkout files + - name: Checkout repo 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 - run: Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')" - - # Run TOC-less version - # Rendered content for Leanpub and Coursera is very similar. - # This job creates a shared scaffold for both. - - name: Run TOC-less version of render - id: tocless - run: Rscript -e "ottrpal::render_without_toc()" - - # 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.tocless.outcome != 'success' - run: | - echo Bookdown status ${{steps.bookdown.outcome}} - echo Toc-less status ${{steps.tocless.outcome}} - exit 1 - - - 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 + - name: Readability report + uses: Rebilly/lexi@v2 with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: latest commit + github-token: ${{ secrets.GH_PAT }} + glob: '**/*.md' - - 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") - tocless_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/no_toc/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 "tocless_link=$tocless_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. +############################# Render Preview ################################### + render-preview: + name: Render preview + needs: yaml-check + runs-on: ubuntu-latest + if: ${{needs.yaml-check.outputs.toggle_render_preview == 'true'}} + permissions: + pull-requests: write + contents: write - _Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_ - edit-mode: replace + steps: + - 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 d1fa46a..344b523 100644 --- a/.github/workflows/render-all.yml +++ b/.github/workflows/render-all.yml @@ -1,14 +1,15 @@ +# Candace Savonen 2021 +# Updated April 2025 -# Candace Savonen Apr 2021 - -name: Render all output courses +name: Render website on: workflow_dispatch: push: branches: [ main, staging ] paths: - - '**.Rmd' + - '*.qmd' + - '*.Rmd' - assets/* - quizzes/* @@ -27,20 +28,13 @@ jobs: with: files: config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence. outputs: - toggle_bookdown: "${{ env.RENDER_BOOKDOWN }}" - toggle_coursera: "${{ env.RENDER_COURSERA }}" - toggle_leanpub: "${{ env.RENDER_LEANPUB }}" - make_book_txt: "${{ env.MAKE_BOOK_TXT }}" + toggle_website: "${{ env.RENDER_WEBSITE }}" rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" - toggle_quiz_check: "${{ env.CHECK_QUIZZES }}" - render-bookdown: - name: Render bookdown + render-website: + name: Render website needs: yaml-check runs-on: ubuntu-latest - container: - image: ${{needs.yaml-check.outputs.rendering_docker_image}} - if: ${{needs.yaml-check.outputs.toggle_bookdown == 'yes'}} steps: - name: checkout @@ -49,200 +43,11 @@ 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: rm -rf docs/* - - # Run bookdown rendering - - name: Run bookdown render - id: bookdown - run: | - Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all'); - file.copy(from = 'assets', to = 'docs/assets', overwrite = TRUE)" - - # 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 step - if: steps.bookdown.outcome != 'success' - run: | - echo Bookdown status ${{steps.bookdown.outcome}} - exit 1 - - # Commit the rendered bookdown files - - name: Commit rendered bookdown files - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} - git fetch origin - git add --force docs/* - git commit -m 'Render bookdown' || echo "No changes to commit" - git pull --allow-unrelated-histories --strategy-option=ours - git push -u origin main || echo "No changes to push" - - render-tocless: - name: Render TOC-less version for Leanpub or Coursera - needs: [yaml-check, render-bookdown] - 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'}} - - steps: - - name: checkout - uses: actions/checkout@v4 + - name: Run render + id: render + uses: ottrproject/ottr-preview@main with: - fetch-depth: 0 + toggle_website: ${{needs.yaml-check.outputs.toggle_website}} + preview: false 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' - - # Rendered content for Leanpub and Coursera is very similar. - # This job creates a shared scaffold for both. - - name: Run TOC-less version of render - id: tocless - run: Rscript -e "ottrpal::render_without_toc()" - - # Commit the TOC-less version files - - name: Commit tocless bookdown files - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} - git fetch origin - git add --force docs/no_toc* - git commit -m 'Render toc-less' || echo "No changes to commit" - git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours - git push -u origin main || echo "No changes to push" - - render-leanpub: - name: Finish Leanpub prep - needs: [yaml-check, render-tocless] - runs-on: ubuntu-latest - container: - image: jhudsl/ottrpal:main - if: ${{needs.yaml-check.outputs.toggle_leanpub == 'yes'}} - - steps: - - name: checkout - uses: actions/checkout@v4 - with: - 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' - - # Create screenshots - - name: Run the screenshot creation - run: | - # Remove old folder - 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) - - # We want a fresh run of the renders each time - - name: Delete manuscript/ - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - rm -rf manuscript/ - git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} - git fetch origin - git add . - git commit -m 'Delete manuscript folder' || echo "No changes to commit" - git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours - 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'}} - run: | - Rscript -e "ottrpal::bookdown_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}}'), \ - quiz_dir = NULL)" - - - name: Run ottrpal::bookdown_to_embed_leanpub - if: ${{ needs.yaml-check.outputs.toggle_quiz_check == 'yes'}} - run: | - Rscript -e "ottrpal::bookdown_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}}'))" - - # 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 commit -m 'Render Leanpub' || echo "No changes to commit" - git pull --allow-unrelated-histories --strategy-option=ours - git push --force --set-upstream origin main || echo "No changes to push" - - render-coursera: - name: Finish Coursera prep - needs: [yaml-check, render-tocless] - runs-on: ubuntu-latest - container: - image: ${{needs.yaml-check.outputs.rendering_docker_image}} - if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes'}} - - steps: - - name: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GH_PAT }} - - - name: Login as github action - 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' - - # 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' - id: coursera - run: Rscript -e "ottrpal::convert_coursera_quizzes()" - - # Commit the rendered bookdown files - # Only commit coursera quizzes if the directory is present - - name: Commit rendered Coursera files - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} - git fetch origin - 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" - git pull --rebase --allow-unrelated-histories --strategy-option=ours - git push -u origin main || echo "No changes to push" + docker_image: ${{needs.yaml-check.outputs.rendering_docker_image}} diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml deleted file mode 100644 index dae4141..0000000 --- a/.github/workflows/transfer-rendered-files.yml +++ /dev/null @@ -1,117 +0,0 @@ -# This code was adapted from code written by Josh Shapiro -# for the Childhood Cancer Data Lab, an initiative of Alexs Lemonade Stand Foundation. -# https://github.com/AlexsLemonade/exercise-notebook-answers - -# Adapted for this jhudsl repository by Candace Savonen Apr 2021 - -name: Copy over from main template to _Quizzes repo - -on: - workflow_dispatch: - workflow_run: - workflows: [ "Render all output courses" ] - branches: [ main, staging ] - types: - - completed - -jobs: - - yaml-check: - name: Load user automation choices - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - # 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_coursera: "${{ env.RENDER_COURSERA }}" - toggle_leanpub: "${{ env.RENDER_LEANPUB }}" - - - file-quizzes-pr: - name: File _Quizzes Transfer PR - runs-on: ubuntu-latest - container: - image: jhudsl/ottrpal:main - needs: [yaml-check] - if: ${{needs.yaml-check.outputs.toggle_coursera == 'yes' || needs.yaml-check.outputs.toggle_leanpub == 'yes'}} - - steps: - - name: Checkout from Bookdown Repo - uses: actions/checkout@v4 - with: - path: bookdown - token: ${{ secrets.GH_PAT }} - - - name: Run git repo check - id: git_repo_check - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - # What's the Quizzes repository's name? - QUIZ_REPO=$(echo ${GITHUB_REPOSITORY} | sed "s/_Bookdown/ /g" | sed "s/_Template/ /g" | awk '{print $1"_Quizzes"}') - echo $QUIZ_REPO - - # Run repo check script - curl -o git_repo_check.R https://raw.githubusercontent.com/jhudsl/ottr-reports/main/scripts/git_repo_check.R - results=$(Rscript --vanilla git_repo_check.R --repo "$GITHUB_REPOSITORY" --git_pat "$GH_PAT") - echo $QUIZ_REPO exists: $results - - echo "git_results=$results" >> $GITHUB_OUTPUT - echo "leanpub_repo=$QUIZ_REPO" >> $GITHUB_OUTPUT - - - name: Checkout code from Leanpub repo - if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} - uses: actions/checkout@v4 - with: - path: quizzes - repository: ${{ steps.git_repo_check.outputs.leanpub_repo }} - token: ${{ secrets.GH_PAT }} - - - name: Get files from Bookdown repo - if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} - shell: bash - env: - GH_PAT: ${{ secrets.GH_PAT }} - run: | - # Copy over images folder (from bookdown to quizzes repo) - mkdir -p quizzes/resources/chapt_screen_images - cp bookdown/resources/chapt_screen_images/* quizzes/resources/chapt_screen_images - - # Copy over _bookdown.yml (from bookdown to quizzes repo) - cp bookdown/_bookdown.yml quizzes/_bookdown.yml - - - name: Create PR with resources files - if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} - uses: peter-evans/create-pull-request@v3 - id: cpr - with: - path: quizzes # Must create the PR in the Quizzes Repo - token: ${{ secrets.GH_PAT }} - commit-message: Copy files from Bookdown repository - signoff: false - branch: auto_copy_rendered_files - delete-branch: true - title: 'GHA: Automated transfer of ottrpal-needed files from Bookdown repository' - body: | - ### Description: - This PR was initiated by transfer-rendered.yml in the Bookdown repository. - It copies over the ottrpal-needed folder (for the `bookdown_to_embed_leanpub(render = FALSE)` function - to run properly. - - resources/chapt_screen_images/* - - _bookdown.yml - labels: | - automated - reviewers: $GITHUB_ACTOR - - # Write out PR info - - name: Check outputs - if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" From 0a72609e9aa7156603360b23b6a716e8f99486f4 Mon Sep 17 00:00:00 2001 From: jhudsl-robot Date: Fri, 6 Jun 2025 21:06:03 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=94=84=20Created=20local=20'.github/w?= =?UTF-8?q?orkflows/render-site.yml'=20from=20remote=20'.github/workflows/?= =?UTF-8?q?render-all.yml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release-renderActionTry2 --- .github/workflows/render-site.yml | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/render-site.yml diff --git a/.github/workflows/render-site.yml b/.github/workflows/render-site.yml new file mode 100644 index 0000000..344b523 --- /dev/null +++ b/.github/workflows/render-site.yml @@ -0,0 +1,53 @@ +# Candace Savonen 2021 +# Updated April 2025 + +name: Render website + +on: + workflow_dispatch: + push: + branches: [ main, staging ] + paths: + - '*.qmd' + - '*.Rmd' + - assets/* + - quizzes/* + +jobs: + + yaml-check: + name: Load user automation choices + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + # 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_website: "${{ env.RENDER_WEBSITE }}" + rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" + + render-website: + name: Render website + needs: yaml-check + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GH_PAT }} + + - 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}} From 1e9c6e1814411eb01aa33da3cada73caabe9d87e Mon Sep 17 00:00:00 2001 From: jhudsl-robot Date: Fri, 6 Jun 2025 21:06:03 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=94=84=20Synced=20local=20'config=5Fa?= =?UTF-8?q?utomation.yml'=20with=20remote=20'config=5Fautomation.yml'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit release-renderActionTry2 --- config_automation.yml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/config_automation.yml b/config_automation.yml index f17b0b2..3bf069a 100644 --- a/config_automation.yml +++ b/config_automation.yml @@ -1,27 +1,33 @@ +### 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: no +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: true +# Would you like a readability report on your markdowns? +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: true ##### Renderings run upon merge to main branch ##### # Rendering each platform's content -render-bookdown: yes -render-leanpub: yes -render-coursera: no - -## Automate the creation of Book.txt file? TRUE/FALSE? -## This is only relevant if render-leanpub is yes, otherwise it will be ignored -make-book-txt: TRUE +render-website: rmd_web # What docker image should be used for rendering? # The default is jhudsl/base_ottr:main