Make Live Notebooks #66
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
name: Make Live Notebooks | |
# Make live versions of .Rmd files in training modules and optionally rerender notebooks | |
# This workflow only runs when it is manually dispatched | |
on: | |
workflow_dispatch: | |
inputs: | |
rendering: | |
description: Should rendering be completed? TRUE or FALSE | |
required: true | |
default: "TRUE" | |
jobs: | |
make-live: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: | |
image: ccdl/training_rstudio:edge | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure git | |
run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
- name: Load 1Password secrets | |
uses: 1password/load-secrets-action@v2 | |
with: | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TRAINING_OP_SERVICE_ACCOUNT_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.OP_TRAINING_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.OP_TRAINING_SECRET_ACCESS_KEY }} | |
DOCS_BOT_GITHUB_TOKEN: ${{ secrets.OP_DOCS_BOT_GITHUB_TOKEN }} | |
- name: Download data from S3 | |
if: github.event.inputs.rendering == 'TRUE' | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
run: | | |
aws s3 sync s3://ccdl-training-data/training-modules/ . | |
- name: Render notebooks | |
env: | |
RENDER_RMD: ${{ github.event.inputs.rendering }} | |
run: bash scripts/render-live.sh | |
# Make changes to pull request here | |
- name: Create PR with rendered notebooks | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ env.DOCS_BOT_GITHUB_TOKEN }} | |
commit-message: Live and rendered notebooks | |
signoff: false | |
branch: auto_render_live | |
delete-branch: true | |
title: "GHA: Automated live (rendered) versions of the notebooks" | |
body: | | |
### Description: | |
This PR auto-generated from github actions running make-live.R with: | |
- The latest notebooks on the master branch | |
- The latest docker image on Dockerhub | |
### Instruction for reviewers: | |
Make sure that all the notebooks have been made into `_live` versions appropriately and have the updates you expect. | |
labels: | | |
automated | |
reviewers: $GITHUB_ACTOR | |
# Write PR info | |
- name: Check outputs | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |