Skip to content

Commit

Permalink
Adds CI action validating new notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Jul 29, 2024
1 parent 9091012 commit f7d9a9c
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/validate_new_notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Validate new notebooks

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- 'docs/core_docs/**'
workflow_dispatch:

jobs:
validate-new-notebooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- name: Validate new notebooks
run: |
new_notebooks=$(echo ${{ steps.changed-files.outputs.added_files }} | tr ' ' '\n' | grep '\.ipynb$')
if [ -n "$new_notebooks" ]; then
for notebook in $new_notebooks; do
yarn notebook:validate "$notebook"
done
fi
42 changes: 42 additions & 0 deletions docs/core_docs/docs/how_to/testing.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"const thingy = \"mabob\";\n",
"\n",
"thingythingy;"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "TypeScript",
"language": "typescript",
"name": "tslab"
},
"language_info": {
"codemirror_mode": {
"mode": "typescript",
"name": "javascript",
"typescript": true
},
"file_extension": ".ts",
"mimetype": "text/typescript",
"name": "typescript",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
2 changes: 1 addition & 1 deletion docs/core_docs/scripts/quarto-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const fs = require("node:fs");
const { glob } = require("glob");
const { execSync } = require("node:child_process");

const IGNORED_CELL_REGEX = /```\w*?\n\/\/ ?@ls-docs-hide-cell\n[\s\S]*?```/g;
const IGNORED_CELL_REGEX = /```\w*?\n\/\/ ?@lc-docs-hide-cell\n[\s\S]*?```/g;

async function main() {
const allIpynb = await glob("./docs/**/*.ipynb");
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"test:standard:int": "turbo test:standard:int",
"test:standard": "yarn test:standard:unit && yarn test:standard:int",
"example": "yarn workspace examples start",
"notebook:validate": "yarn workspace core_docs validate",
"precommit": "turbo precommit",
"docs": "yarn workspace core_docs start",
"docs:api_refs": "yarn workspace api_refs start",
Expand Down

0 comments on commit f7d9a9c

Please sign in to comment.