From 74920f5a7b30cc00bbb360bb302ffc9e443eb70c Mon Sep 17 00:00:00 2001 From: Mattia Almansi Date: Tue, 22 Oct 2024 09:52:38 +0200 Subject: [PATCH] do not show untouched notebooks in preview (#235) * do not show untouched notebooks in preview * fix script * cleanup * test * test * revert tests --- .github/workflows/on-pull-request.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 71a95d72..721660f6 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -42,6 +42,25 @@ jobs: with: python-version: '3.x' cache: 'pip' + - uses: actions/checkout@v4 + - name: Get changed notebooks + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: | + **.ipynb + - name: Remove untouched notebooks + id: remove-untouched-notebooks + env: + ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: |- + for file in ${ALL_CHANGED_FILES}; do + mv "$file" "$file".keep + done + find . -type f -name "*.ipynb" -not -path "./templates/*" -exec rm -f {} + + for file in ${ALL_CHANGED_FILES}; do + mv "$file".keep "$file" + done - run: pip install -r requirements.txt - run: make build-book PRE_BUILD_DIR=${{ env.PRE_BUILD_DIR }} PRE_BUILD_FLAGS=${{ env.PRE_BUILD_FLAGS }} - uses: rossjrw/pr-preview-action@v1