diff --git a/.github/workflows/test-all-notebooks-weekly.yml b/.github/workflows/test-all-notebooks-weekly.yml index 9f18fa7..3f5cfd9 100644 --- a/.github/workflows/test-all-notebooks-weekly.yml +++ b/.github/workflows/test-all-notebooks-weekly.yml @@ -1,4 +1,4 @@ -name: Test all notebooks (weekly) +name: Test all notebooks (weekly + on-demand) on: schedule: @@ -7,9 +7,21 @@ on: workflow_dispatch: inputs: filter: - description: 'Optional substring filter on notebook paths (regex)' + description: 'Regex on notebook paths (leave blank for all). Example: tutorials/.*' required: false default: '' + single_notebook: + description: 'Run a single notebook (full path). Overrides filter if set.' + required: false + default: '' + file_issue: + description: 'File/update the weekly-notebook-sweep tracking issue on failure' + required: false + default: 'true' + type: choice + options: + - 'true' + - 'false' permissions: contents: read @@ -32,15 +44,21 @@ jobs: id: list run: | set -euo pipefail - all=$(python .github/scripts/list_notebooks.py) + single='${{ github.event.inputs.single_notebook }}' filter='${{ github.event.inputs.filter }}' - if [ -n "$filter" ]; then - all=$(echo "$all" | python -c " + if [ -n "$single" ]; then + all=$(python -c "import json; print(json.dumps(['$single']))") + echo "Manual single-notebook run: $single" + else + all=$(python .github/scripts/list_notebooks.py) + if [ -n "$filter" ]; then + all=$(echo "$all" | python -c " import json, re, sys pat = re.compile(r'''$filter''') nbs = json.load(sys.stdin) print(json.dumps([n for n in nbs if pat.search(n)])) ") + fi fi echo "notebooks=$all" >> "$GITHUB_OUTPUT" count=$(echo "$all" | python -c "import json,sys;print(len(json.load(sys.stdin)))") @@ -161,7 +179,7 @@ jobs: EOF - name: File or update tracking issue if any failures - if: steps.report.outputs.failed_count != '0' + if: steps.report.outputs.failed_count != '0' && github.event.inputs.file_issue != 'false' uses: actions/github-script@v7 with: script: |