Skip to content

Commit

Permalink
ci[patch]: Fix notebook validation workflow (#6298)
Browse files Browse the repository at this point in the history
* Fix notebook validation workflow

* Test file

* Delete test notebook
  • Loading branch information
jacoblee93 authored Jul 31, 2024
1 parent f768cf7 commit b1b9a83
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/validate_new_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,23 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- name: Validate new notebooks
- name: Check for new or modified notebooks
id: check_notebooks
run: |
new_notebooks=$(echo '${{ steps.changed-files.outputs.added_files }}' | tr ' ' '\n' | grep '\.ipynb$' || true)
echo "New notebooks: $new_notebooks"
if [ -n "$new_notebooks" ]; then
for notebook in $new_notebooks; do
notebooks=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ' ' '\n' | grep '\.ipynb$' || true)
echo "Affected notebooks: $notebooks"
echo "has_affected_notebooks=$([ -n "$notebooks" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
- name: Build examples
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
run: yarn turbo:command build --filter=examples
- name: Validate affected notebooks
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
run: |
notebooks=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | tr ' ' '\n' | grep '\.ipynb$' || true)
if [ -n "$notebooks" ]; then
for notebook in $notebooks; do
yarn notebook:validate "$notebook"
done
else
echo "No new notebooks to validate."
echo "No notebooks to validate."
fi

0 comments on commit b1b9a83

Please sign in to comment.