Repository navigation
reactor: GitHub Action for improved notebook file handling #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
042b81b
reactor: GitHub Action for improved notebook file handling
kunalagra bae9546
chore: standardize quotes in action.yml
kunalagra f1077e0
fix: update paths input description to reflect newline-separated format
kunalagra f6a6576
feat: add action integration test
kunalagra 0c1705c
chore: Register for action.yml changes in pr
kunalagra e68d08b
feat: add push trigger for action integration test workflow
kunalagra d28be7c
fix: update action integration test cases and add new notebook for va…
kunalagra 30c9f8e
fix: remove paths from GA integation test as it is to narrow
kunalagra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Action Integration Test | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: 'Optional branch, tag, or SHA to checkout for testing' | ||
| required: false | ||
| default: 'main' | ||
| push: | ||
| branches: | ||
| - 'main' | ||
|
|
||
| jobs: | ||
| test-action: | ||
| name: Test composite action behavior | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| case: | ||
| - name: clean notebook should pass | ||
| path: tests/e2e_notebooks/test_nochange.ipynb | ||
| expect_failure: false | ||
| - name: clean notebook with parentheses in filename should pass | ||
| path: tests/e2e_notebooks/test (nochange).ipynb | ||
| expect_failure: false | ||
| - name: dirty notebook with space in filename should fail | ||
| path: tests/e2e_notebooks/test metadata.ipynb | ||
| expect_failure: true | ||
| - name: dirty notebook should fail | ||
| path: tests/e2e_notebooks/test_metadata.ipynb | ||
| expect_failure: true | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
|
|
||
| - name: Run action for ${{ matrix.case.name }} | ||
| id: run_case | ||
| continue-on-error: true | ||
| uses: ./ | ||
| with: | ||
| paths: | | ||
| ${{ matrix.case.path }} | ||
|
|
||
| - name: Assert expected outcome | ||
| if: always() | ||
| shell: bash | ||
| run: | | ||
| expected_outcome="${{ matrix.case.expect_failure && 'failure' || 'success' }}" | ||
| actual_outcome="${{ steps.run_case.outcome }}" | ||
|
|
||
| if [ "$actual_outcome" != "$expected_outcome" ]; then | ||
| echo "Case: ${{ matrix.case.name }}" | ||
| echo "Path: ${{ matrix.case.path }}" | ||
| echo "Expected outcome: $expected_outcome" | ||
| echo "Actual outcome: $actual_outcome" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "This notebook should not be changed by nbstripout." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "1+1 # This cell has `\"init_cell:\" true`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "metadata": { | ||
| "keep_output": true | ||
| }, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "4" | ||
| ] | ||
| }, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "2+2 # This cell has `\"keep_output:\" true`" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "celltoolbar": "Edit Metadata", | ||
| "kernelspec": { | ||
| "display_name": "Python 2", | ||
| "language": "python", | ||
| "name": "python2" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 2 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython2", | ||
| "version": "2.7.11" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 0 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "This notebook tests that cells with either `\"keep_output\": true` or `\"init_cell\": true` are not stripped." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 1, | ||
| "metadata": { | ||
| "collapsed": false, | ||
| "init_cell": true | ||
| }, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "2" | ||
| ] | ||
| }, | ||
| "execution_count": 1, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "1+1 # This cell has `\"init_cell:\" true`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, | ||
| "metadata": { | ||
| "collapsed": false, | ||
| "keep_output": true | ||
| }, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "4" | ||
| ] | ||
| }, | ||
| "execution_count": 2, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "2+2 # This cell has `\"keep_output:\" true`" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 3, | ||
| "metadata": { | ||
| "collapsed": false | ||
| }, | ||
| "outputs": [ | ||
| { | ||
| "data": { | ||
| "text/plain": [ | ||
| "6" | ||
| ] | ||
| }, | ||
| "execution_count": 3, | ||
| "metadata": {}, | ||
| "output_type": "execute_result" | ||
| } | ||
| ], | ||
| "source": [ | ||
| "3+3" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "celltoolbar": "Edit Metadata", | ||
| "kernelspec": { | ||
| "display_name": "Python 2", | ||
| "language": "python", | ||
| "name": "python2" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 2 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython2", | ||
| "version": "2.7.11" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 0 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.