Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/clear-notebook-outputs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# .github/workflows/clear-notebook-outputs.yml
# This workflow removes the outputs from Jupyter notebooks (.ipynb files)
# whenever changes are pushed to the repository.
# When we run a Notebook locally it generates output that we don't want to commit
name: Remove Notebook Outputs
permissions:
contents: write

on:
push:
push:
branches:
- '**'
pull_request:
branches:
- '**'


jobs:
remove-notebook-outputs:
runs-on: ubuntu-latest
steps:
- name: Checkout source repo
uses: actions/checkout@v4

- name: Set up Git
run: |
git config --global user.name "Clear Notebook Outputs Action"
git config --global user.email "[email protected]"

- name: Install prerequisites
run: |
sudo apt-get update -y

sudo apt-get install python3.8 -y

echo ✅ Install Jupyter notebook
echo ✅ ------------------------
# Install Jupyter notebook
sudo apt-get install jupyter -y

- name: Clear Jupyter notebook run outputs
run: |
# Get all notebook files
files=$(git ls-files '*.ipynb')
[ -z "$files" ] && exit 0

for f in $files; do
echo $f
# Clear outputs + execution_count in place
jupyter nbconvert \
--ClearOutputPreprocessor.enabled=True \
--inplace "$f"

# Re-stage cleaned file
git add "$f"
done

if git diff --cached --quiet; then
echo "No staged changes; skipping commit"
exit 0
else
git commit -m "Clear notebook outputs" --no-verify
git push origin HEAD:${{ github.ref_name }}
fi
1 change: 1 addition & 0 deletions dotnet/01_connect_database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2f0c35d4",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down
1 change: 1 addition & 0 deletions dotnet/101_aggregation_pipeline_arrays.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8b0f11e1",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down
1 change: 1 addition & 0 deletions dotnet/102_aggregation_pipeline_unwind.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5a9c4ac7",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down
4 changes: 4 additions & 0 deletions dotnet/11_find_arrays.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8dce784e",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down Expand Up @@ -121,6 +122,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8dc11f3e",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down Expand Up @@ -161,6 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "f3e98e38",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down Expand Up @@ -204,6 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a84c5e70",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down
2 changes: 2 additions & 0 deletions dotnet/60_indexes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8b0240c2",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down Expand Up @@ -200,6 +201,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "603d8946",
"metadata": {
"language_info": {
"name": "polyglot-notebook"
Expand Down
1 change: 0 additions & 1 deletion java/01_connect_database.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@
"execution_count": null,
"id": "annoying-tattoo",
"metadata": {
"scrolled": true,
"vscode": {
"languageId": "java"
}
Expand Down