Skip to content

Conversation

@lagamura
Copy link
Contributor

Implementing repos action #205

Then users can leverage it in a simple workflow like:

name: Check Notebooks Output

on:
  pull_request:
    paths:
      - '**.ipynb'
  push:
    branches:
      - main
    paths:
      - '**.ipynb'
  workflow_dispatch:

jobs:
  check-notebooks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v6
      
      - name: Check notebooks are stripped
        uses: kynan/nbstripout@main
        with:
          paths: '**/*.ipynb'
          # Optionally specify extra keys to strip
          # extra-keys: 'metadata.celltoolbar cell.metadata.heading_collapsed'

@kynan
Copy link
Owner

kynan commented Dec 13, 2025

Thanks for proposing this! As mentioned in #205 I think this should live in its own GitHub repo. We can then add a reference to the nbstripout README for how to use it.

This means you can maintain the action yourself and are not dependent on me for making changes. What do you think?

@lagamura
Copy link
Contributor Author

I wouldn't create a separate repo only for adding this re-usable action, as I am not adding any core functionality in nbstripout.
Also, having the action in the same codebase is more coherent, will bring more visibility to the repository, and it's easier to be tested directly with on-going development. If you have any specific concerns regarding how github actions work, let me know, and of course the final call is yours 🎯

@kynan
Copy link
Owner

kynan commented Dec 17, 2025

How did you test this? And how would I be able to test this?

If you really think action should be in the main nbstripout repo it definitely needs extensive documentation in the README :)

@lagamura
Copy link
Contributor Author

I found out this interesting tool for testing on-development actions: nektos
Note that github actions are a bit particular in testing as they run in the Github-runners containers with event-triggers.

on:
pull_request:
paths:
- '**.ipynb'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this doesn't recurse into subdirectories? Same for push below?

Copy link
Contributor Author

@lagamura lagamura Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what does this rule sets, is the actual event trigger rule for the workflow.
**.ipynb means that if any .ipynb files are included into a PR or a pushed commit to main branch then the guard check will be triggered. These section is independent of the re-usable action and its up to users to define their own trigger rules.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this match .ipynb files in subdirectories also? Or only the root?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The **.ipynb will match any files of type .ipynb in subdirectories recursively, if someone wants to match the event trigger for a specific subdir, they can do something like <subdir>/*.ipynb or recursively under a subdir like:
<subdir>/**/*.ipynb

- main
paths:
- '**.ipynb'
workflow_dispatch:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this meant to be empty? Is this valid syntax?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, workflow_dispatch just enables custom triggering of a workflow.

action.yml Outdated

if [ -z "$notebooks" ]; then
echo "No notebook files found"
echo "notebooks=" >> $GITHUB_OUTPUT
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for passing output to the action below? The documentation mentions some other requirements. Is this not needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax echo "message" >> $GITHUB_OUTPUT
will propagate the to the workflow that will use the nbstripout action.
Here we can just remove the echoing because "notebooks=" is empty when no notebooks found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra arguments you are refering to in the docs are for passing the output between dependant workflows, but we don't have such an advanced case here.

Copy link
Owner

@kynan kynan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let's submit this and iterate as needed.

@kynan kynan merged commit d4149fd into kynan:main Jan 3, 2026
15 checks passed
@kynan kynan added this to the 0.8.3 milestone Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants