From cdc0836cd11771c3e16a7551bed8aa666ad8c955 Mon Sep 17 00:00:00 2001 From: cansavvy Date: Fri, 10 Jan 2025 19:00:08 +0000 Subject: [PATCH 1/2] =?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-2.1.0 --- config_automation.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config_automation.yml b/config_automation.yml index a028a0d..bcbe613 100644 --- a/config_automation.yml +++ b/config_automation.yml @@ -10,6 +10,10 @@ render-preview: yes spell-check: yes # Style any R code style-code: yes +# Would you like your markdown files to be checked for formatting +markdown-linter: yes +# Would you like a readability report on your markdowns? +readability-report: yes # Test build the docker image if any docker-relevant files have been changed docker-test: no # Should URLs be tested periodically? @@ -27,4 +31,4 @@ make-book-txt: yes # What docker image should be used for rendering? # The default is jhudsl/base_ottr:main -rendering-docker-image: 'jhudsl/ocs_guide:main' +rendering-docker-image: 'jhudsl/base_ottr:main' From 79aa92f103de470e6785e94bae7f9c08aa9a355c Mon Sep 17 00:00:00 2001 From: cansavvy Date: Fri, 10 Jan 2025 19:00:08 +0000 Subject: [PATCH 2/2] =?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-2.1.0 --- .github/workflows/check-url.yml | 10 ++ .github/workflows/pull_request.yml | 31 +++++- .github/workflows/render-all.yml | 10 +- .github/workflows/send-updates.yml | 4 +- .github/workflows/starting-course.yml | 144 ++++++++++++++++++++++++++ 5 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/starting-course.yml diff --git a/.github/workflows/check-url.yml b/.github/workflows/check-url.yml index a437049..090f12f 100644 --- a/.github/workflows/check-url.yml +++ b/.github/workflows/check-url.yml @@ -78,6 +78,16 @@ 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 }} + 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 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f5ffef0..091af95 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -48,6 +48,8 @@ jobs: toggle_style_code: "${{ env.STYLE_CODE }}" toggle_url_check: "${{ env.URL_CHECKER }}" toggle_quiz_check: "${{ env.CHECK_QUIZZES }}" + toggle_md_linter: "${{ env.MARKDOWN_LINTER }}" + toggle_readability: "${{ env.READABILITY_REPORT }}" toggle_render_preview: "${{ env.RENDER_PREVIEW }}" rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" @@ -60,8 +62,9 @@ jobs: with: check_type: spelling error_min: 3 - gh_pat: secrets.GH_PAT branch_name: ${GITHUB_HEAD_REF} + secrets: + gh_pat: ${{ secrets.GH_PAT }} url-check: name: Check URLs @@ -71,8 +74,9 @@ jobs: with: check_type: urls error_min: 0 - gh_pat: secrets.GH_PAT branch_name: ${GITHUB_HEAD_REF} + secrets: + gh_pat: ${{ secrets.GH_PAT }} quiz-check: name: Check quiz formatting @@ -82,8 +86,9 @@ jobs: with: check_type: quiz_format error_min: 0 - gh_pat: secrets.GH_PAT branch_name: ${GITHUB_HEAD_REF} + secrets: + gh_pat: ${{ secrets.GH_PAT }} ############################# Style the code ################################### style-code: @@ -110,6 +115,26 @@ jobs: git commit -m 'Style *mds' || echo "No changes to commit" git push origin || echo "No changes to commit" +############################# Readability Report ################################### + + readability-report: + name: Readability report + needs: yaml-check + runs-on: ubuntu-latest + if: ${{needs.yaml-check.outputs.toggle_readability == 'yes'}} + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Readability report + uses: Rebilly/lexi@v2 + with: + github-token: ${{ secrets.GH_PAT }} + glob: '**/*.md' + ############################# Render Preview ################################### render-preview: diff --git a/.github/workflows/render-all.yml b/.github/workflows/render-all.yml index b2e39b2..56dffb7 100644 --- a/.github/workflows/render-all.yml +++ b/.github/workflows/render-all.yml @@ -8,7 +8,8 @@ on: push: branches: [ main, staging ] paths: - - '**md$' + - '*.qmd' + - '*.Rmd' - assets/* - quizzes/* @@ -101,7 +102,7 @@ jobs: git add --force docs/* git commit -m 'Render course' || echo "No changes to commit" git status docs/* - git push -u origin main || echo "No changes to push" + git push --force -u origin main || echo "No changes to push" render-tocless: name: Render TOC-less version for Leanpub or Coursera @@ -149,7 +150,7 @@ jobs: git add --force docs/no_toc* git commit -m 'Render toc-less' || echo "No changes to commit" git status docs/no_toc* - git push -u origin main || echo "No changes to push" + git push --force -u origin main || echo "No changes to push" render-leanpub: name: Finish Leanpub prep @@ -188,6 +189,7 @@ jobs: --git_pat ${{ secrets.GH_PAT }} \ --repo $GITHUB_REPOSITORY \ --output_dir resources/chapt_screen_images) + rm make_screenshots.R # We want a fresh run of the renders each time - name: Delete manuscript/ @@ -276,4 +278,4 @@ jobs: git add --force docs/* git commit -m 'Render Coursera quizzes' || echo "No changes to commit" git status - git push -u origin main || echo "No changes to push" + git push --force -u origin main || echo "No changes to push" diff --git a/.github/workflows/send-updates.yml b/.github/workflows/send-updates.yml index f636dc0..a86b21a 100644 --- a/.github/workflows/send-updates.yml +++ b/.github/workflows/send-updates.yml @@ -23,8 +23,8 @@ jobs: - 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' + git config --local user.email "itcrtrainingnetwork@gmail.com" + git config --local user.name "jhudsl-robot" - name: Get the version id: get_tag diff --git a/.github/workflows/starting-course.yml b/.github/workflows/starting-course.yml new file mode 100644 index 0000000..144aa3d --- /dev/null +++ b/.github/workflows/starting-course.yml @@ -0,0 +1,144 @@ +# Code adapted from https://github.com/JetBrains/intellij-platform-plugin-template/blob/deb171483598ee8a5d7621154db880e87b4db4ef/.github/workflows/template-cleanup.yml +# by Candace Savonen for this repository. + +name: Starting a new course + +on: + push: + branches: [ main, staging ] + workflow_dispatch: + +jobs: + # Run cleaning process only if workflow is triggered by not being in the Bookdown template anymore + template-cleanup: + name: Template Cleanup + runs-on: ubuntu-latest + if: github.event.repository.name != 'OTTR_Template' + steps: + - name: checkout repo + uses: actions/checkout@v4 + + - name: Login as jhudsl-robot + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" + +##### Delete Template-specific files that aren't needed for new courses + + # Cleanup Template-specific bits + - name: Cleanup + run: | + # Cleanup + mv .github/course_README_template.md README.md + rm -rf \ + .github/workflows/report-maker.yml \ + .github/workflows/send-updates.yml \ + .github/workflows/test-send-updates.yml \ + .github/sync.yml \ + .github/test-sync.yml \ + .github/workflows/starting-course.yml \ + .github/ISSUE_TEMPLATE/course-template-problem-report.md \ + .github/ISSUE_TEMPLATE/course-template-feature-request.md \ + .github/ISSUE_TEMPLATE/new-course-add-to-sync.md \ + .github/ISSUE_TEMPLATE/update-course-info-for-sync.md \ + .github/PULL_REQUEST_TEMPLATE/add_to_sync_template.md \ + resources/code_output \ + resources/screenshots \ + resources/course_screenshots \ + resources/gs_slides \ + resources/image_to_slide_key.tsv \ + resources/images/02-chapter_of_course_files \ + resources/images/03-test_cases_files \ + resources/images/04-figures_files \ + resources/chapt_screen_images \ + Course_Name.rds \ + code_of_conduct.md \ + CONTRIBUTING.md \ + docs/*.html \ + docs/*.md \ + manuscript/* + + + # Commit modified files + - name: Commit deleted files + id: commit_it + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.email "itcrtrainingnetwork@gmail.com" + git config --global user.name "jhudsl-robot" + git add . + git commit -m "Template cleanup" + pushed_it=true + git push || pushed_it=false + echo "pushed_it=$pushed_it" >> $GITHUB_OUTPUT + + # If main is already protected, then file a PR + - name: Create PR with deleted files + if: steps.commit_it.outputs.pushed_it == 'false' + uses: peter-evans/create-pull-request@v3 + id: pr + with: + commit-message: Delete unnecessary files + signoff: false + branch: auto_copy_rendered_files + delete-branch: true + title: 'Automatic course set up' + body: | + ### Description: + This PR was initiated by the github actions. It helps set up this repository to be ready to write your course. + It deletes some remnant files you don't need for your course but were used when this was a template. + labels: | + automated + reviewers: $GITHUB_ACTOR + token: ${{secrets.GH_PAT}} + +##### Filing issues! + + # Issue for what repository settings need to be set + - name: New Course - Set Repository Settings + uses: peter-evans/create-issue-from-file@v4 + with: + title: New Course - Set Repository Settings + content-filepath: .github/automatic-issues/set-repo-settings.md + labels: automated training issue + + # Issue for what needs to be edited + - name: New Course - Templates to Edit + uses: peter-evans/create-issue-from-file@v4 + with: + title: New Course - Templates to Edit + content-filepath: .github/automatic-issues/templates-to-edit.md + labels: automated training issue + + # Issue for how to enroll repo for updates + - name: New Course - Template Update Enrollment + uses: peter-evans/create-issue-from-file@v4 + with: + title: New Course - Template Update Enrollment + content-filepath: .github/automatic-issues/update-enrollment.md + labels: automated training issue + + # Issue for adding a method of feedback + - name: Reminder - Add a method of user feedback + uses: peter-evans/create-issue-from-file@v4 + with: + title: Reminder - Add user feedback method + content-filepath: .github/automatic-issues/add-feedback-method.md + labels: automated training issue + + - name: Get organization name + id: get_org_name + run: | + org_name=$(dirname ${{github.repository}}) + echo "org_name=$org_name" >> $GITHUB_OUTPUT + echo $org_name + + # Issue for adding the course to the jhudsl library + - name: Reminder - Add to jhudsl library + if: ${{ steps.get_org_name.outputs.org_name == 'jhudsl' }} + uses: peter-evans/create-issue-from-file@v4 + with: + title: Reminder - Add to jhudsl library + content-filepath: .github/automatic-issues/add-to-library.md + labels: automated training issue