Skip to content

Commit

Permalink
🔄 Synced local '.github/workflows/render-preview.yml' with remote '.g…
Browse files Browse the repository at this point in the history
…ithub/workflows/render-preview.yml'

release-test
  • Loading branch information
cansavvy committed Nov 3, 2021
1 parent f72a197 commit 5123e19
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/render-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
branches: [ main ]

permissions:
issues: write
pull-requests: write

jobs:
# This workflow contains a single job called "build-all"
build-all:
Expand All @@ -20,16 +24,14 @@ jobs:
with:
# get the full repo
fetch-depth: 0
# use github PAT
token: ${{ secrets.GH_PAT }}

# Run bookdown rendering
- name: Run bookdown render
run: |
docker run \
--mount type=bind,target=/home/rstudio,source=$PWD \
jhudsl/course_template \
Rscript -e "bookdown::render_book('index.Rmd')"
Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all')"
##### If you do not wish to host your course on Coursera, you can delete this section #####
# Run Coursera version
Expand Down Expand Up @@ -63,10 +65,13 @@ jobs:
- name: Build components of the comment
id: build-components
run: |
course_name=$(head -n 1 _bookdown.yml | cut -d'"' -f 2)
bookdown_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/index.html")
coursera_link=$(echo "https://htmlpreview.github.io/?https://raw.githubusercontent.com/$GITHUB_REPOSITORY/preview-${{ github.event.pull_request.number }}/docs/coursera/index.html")
docx_link=$(echo "https://github.com/$GITHUB_REPOSITORY/raw/preview-${{ github.event.pull_request.number }}/docs/$course_name.docx")
echo ::set-output name=bookdown_link::$bookdown_link
echo ::set-output name=coursera_link::$coursera_link
echo ::set-output name=docx_link::$docx_link
echo ::set-output name=time::$(date +'%Y-%m-%d')
echo ::set-output name=commit_id::$GITHUB_SHA
Expand All @@ -79,6 +84,7 @@ jobs:
Re-rendered previews from the latest commit:
- See [preview of Bookdown here](${{ steps.build-components.outputs.bookdown_link }})
- See [preview of Coursera version here](${{ steps.build-components.outputs.coursera_link }})
- Download the [preview of .docx file](${{ steps.build-components.outputs.docx_link }})
_Updated at ${{ steps.build-components.outputs.time }} with changes from ${{ steps.build-components.outputs.commit_id }}_
edit-mode: replace

0 comments on commit 5123e19

Please sign in to comment.