diff --git a/.github/workflows/refresh-notebooks.yaml b/.github/workflows/refresh-notebooks.yaml index ea30f0f84..c8497aae5 100644 --- a/.github/workflows/refresh-notebooks.yaml +++ b/.github/workflows/refresh-notebooks.yaml @@ -89,6 +89,15 @@ jobs: run: | make jupyter_execute + - name: Prepare PR Body + run: | + SUCCESSFUL_NOTEBOOKS=$(cat ./successful_notebooks.txt) + FAILED_NOTEBOOKS=$(cat ./failed_notebooks.txt) + PR_BODY="Automatic PR with notebook refresh for ${{ github.ref_name }}.\n" + PR_BODY+="## Successful Notebooks\n$SUCCESSFUL_NOTEBOOKS\n" + PR_BODY+="## Failed Notebooks\n$FAILED_NOTEBOOKS" + echo "PR_BODY=${PR_BODY}" >> "$GITHUB_ENV" + - name: Open PR uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 with: @@ -97,11 +106,10 @@ jobs: branch: "refresh-notebooks-for-${{ github.ref_name }}" base: "${{ github.ref_name }}" title: "Refresh notebooks for ${{ github.ref_name }}" - body: "Automatic PR with notebooks refresh for ${{ github.ref_name }}." + body: ${{ env.PR_BODY }} add-paths: | docs/**/*.ipynb - stop-runner-linux: name: Stop EC2 runner needs: [refresh-notebooks, start-runner-linux] diff --git a/script/make_utils/jupyter.sh b/script/make_utils/jupyter.sh index 3a9a04028..a3e4475ab 100755 --- a/script/make_utils/jupyter.sh +++ b/script/make_utils/jupyter.sh @@ -57,6 +57,11 @@ elif [ "$WHAT_TO_DO" == "run_all_notebooks" ] then echo "Refreshing notebooks" + SUCCESSFUL_NOTEBOOKS="./successful_notebooks.txt" + FAILED_NOTEBOOKS="./failed_notebooks.txt" + echo "" > "${SUCCESSFUL_NOTEBOOKS}" + echo "" > "${FAILED_NOTEBOOKS}" + # shellcheck disable=SC2207 LIST_OF_NOTEBOOKS=($(find ./docs/ -type f -name "*.ipynb" | grep -v ".nbconvert" | grep -v "_build" | grep -v "ipynb_checkpoints")) @@ -75,7 +80,11 @@ then echo "Refreshing ${NOTEBOOK}" START=$(date +%s) - jupyter nbconvert --to notebook --inplace --execute "${NOTEBOOK}" + if jupyter nbconvert --to notebook --inplace --execute "${NOTEBOOK}"; then + echo "${NOTEBOOK}" >> "${SUCCESSFUL_NOTEBOOKS}" + else + echo "${NOTEBOOK}" >> "${FAILED_NOTEBOOKS}" + fi END=$(date +%s) TIME_EXEC=$((END-START)) print_time_execution "${NOTEBOOK}" ${TIME_EXEC}