generated from jhudsl/AnVIL_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from fhdsl/copying-Ava-fixes-to-ottr
copying ava fixes for ottr
- Loading branch information
Showing
3 changed files
with
90 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,23 +32,24 @@ jobs: | |
# Make the branch fresh | ||
- name: Make the branch fresh | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
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 }}' | ||
echo branch doesnt exist | ||
git checkout -b $branch_name || echo branch exists | ||
git push --set-upstream origin $branch_name | ||
git push --set-upstream origin $branch_name || echo echo branch exists remotely | ||
shell: bash | ||
|
||
|
||
outputs: | ||
toggle_spell_check: "${{ env.SPELL_CHECK }}" | ||
toggle_style_code: "${{ env.STYLE_CODE }}" | ||
toggle_url_check: "${{ env.URL_CHECKER }}" | ||
toggle_quiz_check: "${{ env.CHECK_QUIZZES }}" | ||
toggle_render_preview: "${{ env.RENDER_PREVIEW }}" | ||
rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" | ||
render_student_guide: "${{ env.RENDER_STUDENT_GUIDE }}" | ||
|
||
########################## Make the error reports ############################## | ||
spell-check: | ||
|
@@ -59,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 | ||
|
@@ -69,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 | ||
|
@@ -79,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: | ||
|
@@ -91,7 +96,7 @@ jobs: | |
|
||
steps: | ||
- name: Checkout files | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
@@ -117,47 +122,27 @@ 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 "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
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 | ||
|
||
# Make sure the link for AnVIL feedback is prepopulated for the specific course | ||
- name: Set up feedback link | ||
id: feedback | ||
run: bash scripts/AnVIL_Feedback_Script.sh | ||
|
||
|
||
# Run bookdown rendering | ||
- name: Run bookdown render | ||
id: bookdown | ||
run: Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')" | ||
|
||
# Render a student guide if specified. This is a bit clunky because | ||
# Bookdown does not work well if the files aren't named as such in the | ||
# root directory | ||
- name: Run student guide render | ||
if: ${{needs.yaml-check.outputs.render_student_guide == 'yes'}} | ||
id: student_guide | ||
run: | | ||
mkdir tmp1 | ||
mv _bookdown.yml _output.yml tmp1 | ||
mv student-guide/_bookdown.yml student-guide/_output.yml . | ||
Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')" | ||
mv _bookdown.yml _output.yml student-guide | ||
mv tmp1/_bookdown.yml tmp1/_output.yml . | ||
rm -r tmp1 | ||
|
||
# Run TOC-less version | ||
# Rendered content for Leanpub and Coursera is very similar. | ||
|
@@ -175,6 +160,9 @@ jobs: | |
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 | ||
|
@@ -184,7 +172,7 @@ jobs: | |
echo "changes=$changes" >> $GITHUB_OUTPUT | ||
git add . --force | ||
git commit -m 'Render preview' || echo "No changes to commit" | ||
git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours | ||
git pull --rebase --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours | ||
git push --force || echo "No changes to commit" | ||
shell: bash | ||
|
||
|
@@ -199,13 +187,15 @@ jobs: | |
- name: Build components of the comment | ||
id: build-components | ||
run: | | ||
course_name=$(head -n 1 student-guide/_bookdown.yml | cut -d'"' -f 2| tr " " "-") | ||
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") | ||
student_docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/student-guide/$course_name.docx") | ||
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 "student_docx_link=$student_docx_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}} | ||
|
@@ -218,11 +208,13 @@ jobs: | |
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Re-rendered previews from the latest commit: | ||
- See [preview of Bookdown here](${{ steps.build-components.outputs.bookdown_link }}) | ||
- See [preview of Coursera/Leanpub version here](${{ steps.build-components.outputs.tocless_link }}) | ||
- Download the [preview of the Student Guide .docx file](${{ steps.build-components.outputs.student_docx_link }}) | ||
- :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 }}) | ||
_Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_ | ||
\* 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 | ||
|
Oops, something went wrong.