diff --git a/.github/workflows/delete-preview.yml b/.github/workflows/delete-preview.yml index afd658af..faa83ccd 100644 --- a/.github/workflows/delete-preview.yml +++ b/.github/workflows/delete-preview.yml @@ -18,7 +18,7 @@ jobs: # Check out current repository - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f5968cac..c58b39a7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,9 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + token: ${{ secrets.GH_PAT }} # Use the yaml-env-action action. - name: Load environment from YAML @@ -31,8 +32,9 @@ jobs: # Make the branch fresh - name: Make the branch fresh run: | - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" branch_name='preview-${{ github.event.pull_request.number }}' echo branch doesnt exist @@ -40,6 +42,7 @@ jobs: git push --set-upstream origin $branch_name shell: bash + outputs: toggle_spell_check: "${{ env.SPELL_CHECK }}" toggle_style_code: "${{ env.STYLE_CODE }}" @@ -58,6 +61,7 @@ jobs: check_type: spelling error_min: 3 gh_pat: secrets.GH_PAT + branch_name: ${GITHUB_HEAD_REF} url-check: name: Check URLs @@ -68,6 +72,7 @@ jobs: check_type: urls error_min: 0 gh_pat: secrets.GH_PAT + branch_name: ${GITHUB_HEAD_REF} quiz-check: name: Check quiz formatting @@ -78,6 +83,7 @@ jobs: check_type: quiz_format error_min: 0 gh_pat: secrets.GH_PAT + branch_name: ${GITHUB_HEAD_REF} ############################# Style the code ################################### style-code: @@ -90,7 +96,7 @@ jobs: steps: - name: Checkout files - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -116,16 +122,16 @@ jobs: steps: - name: Checkout files - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # Set up git checkout - name: Set up git checkout run: | - git config --system --add safe.directory "$GITHUB_WORKSPACE" - git config --local user.email "itcrtrainingnetwork@gmail.com" - git config --local user.name "jhudsl-robot" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" branch_name='preview-${{ github.event.pull_request.number }}' git fetch --all diff --git a/.github/workflows/render-all.yml b/.github/workflows/render-all.yml index 4d1bd0d0..7810e387 100644 --- a/.github/workflows/render-all.yml +++ b/.github/workflows/render-all.yml @@ -10,6 +10,7 @@ on: paths: - '**.Rmd' - assets/* + - quizzes/* jobs: @@ -18,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Use the yaml-env-action action. - name: Load environment from YAML @@ -29,6 +30,7 @@ jobs: toggle_bookdown: "${{ env.RENDER_BOOKDOWN }}" toggle_coursera: "${{ env.RENDER_COURSERA }}" toggle_leanpub: "${{ env.RENDER_LEANPUB }}" + make_book_txt: "${{ env.MAKE_BOOK_TXT }}" rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" toggle_quiz_check: "${{ env.CHECK_QUIZZES }}" @@ -42,16 +44,16 @@ jobs: steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - 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" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" # We want a fresh run of the renders each time - name: Delete old docs/* @@ -78,10 +80,11 @@ jobs: 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 origin main || echo "No changes to push" + git push -u origin main || echo "No changes to push" render-tocless: name: Render TOC-less version for Leanpub or Coursera @@ -93,16 +96,16 @@ jobs: steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - 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" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" # Rendered content for Leanpub and Coursera is very similar. # This job creates a shared scaffold for both. @@ -116,10 +119,11 @@ jobs: 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 --allow-unrelated-histories --strategy-option=ours - git push origin main || echo "No changes to push" + git push -u origin main || echo "No changes to push" render-leanpub: name: Finish Leanpub prep @@ -131,16 +135,16 @@ jobs: steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - 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" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" # Create screenshots - name: Run the screenshot creation @@ -155,8 +159,17 @@ jobs: --output_dir resources/chapt_screen_images) # We want a fresh run of the renders each time - - name: Delete old manuscript/ - run: rm -rf manuscript/ + - 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 --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' @@ -164,7 +177,7 @@ jobs: Rscript -e "ottrpal::bookdown_to_embed_leanpub( render = FALSE, \ chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ - make_book_txt = TRUE, \ + make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'), \ quiz_dir = NULL)" - name: Run ottrpal::bookdown_to_embed_leanpub @@ -173,7 +186,7 @@ jobs: Rscript -e "ottrpal::bookdown_to_embed_leanpub( render = FALSE, \ chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ - make_book_txt = TRUE)" + make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'))" # Commit the rendered Leanpub files - name: Commit rendered Leanpub files @@ -181,13 +194,12 @@ jobs: GH_PAT: ${{ secrets.GH_PAT }} run: | mkdir -p manuscript - git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} 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 origin main || echo "No changes to push" + git push --force --set-upstream origin main || echo "No changes to push" render-coursera: name: Finish Coursera prep @@ -199,16 +211,16 @@ jobs: steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_PAT }} - 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" + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" # Run Coursera version - name: Convert Leanpub quizzes to Coursera @@ -222,9 +234,10 @@ jobs: GH_PAT: ${{ secrets.GH_PAT }} run: | git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY} + git fetch origin 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 --allow-unrelated-histories --strategy-option=ours - git push origin main || echo "No changes to push" + git push -u origin main || echo "No changes to push" diff --git a/.github/workflows/transfer-rendered-files.yml b/.github/workflows/transfer-rendered-files.yml index 3c3577ee..e698d987 100644 --- a/.github/workflows/transfer-rendered-files.yml +++ b/.github/workflows/transfer-rendered-files.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Use the yaml-env-action action. - name: Load environment from YAML @@ -65,7 +65,7 @@ jobs: - name: Checkout code from Leanpub repo if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ steps.git_repo_check.outputs.leanpub_repo }} token: ${{ secrets.GH_PAT }} diff --git a/assets/box_images/under_construction.png b/assets/box_images/under_construction.png new file mode 100644 index 00000000..a67bd5c1 Binary files /dev/null and b/assets/box_images/under_construction.png differ