From 5cf94ab58b27288583c4a1b4513f2c90c383f729 Mon Sep 17 00:00:00 2001 From: chrishalcrow Date: Wed, 29 Oct 2025 17:03:38 +0000 Subject: [PATCH 1/2] add look for json changes action --- .../check_for_changes_in_NP_jsons.yml | 74 +++++++++++++++++++ .github/workflows/check_for_new_probes.yml | 3 - 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/check_for_changes_in_NP_jsons.yml diff --git a/.github/workflows/check_for_changes_in_NP_jsons.yml b/.github/workflows/check_for_changes_in_NP_jsons.yml new file mode 100644 index 0000000..37ff53d --- /dev/null +++ b/.github/workflows/check_for_changes_in_NP_jsons.yml @@ -0,0 +1,74 @@ +name: Check for changes in NP json files + +on: + schedule: + - cron: '0 0 * * 2' # Every Tuesday at 00:00 UTC + workflow_dispatch: + +# Grant permissions for the job to write to contents (push) and create PRs. +permissions: + contents: write + pull-requests: write + +jobs: + build-and-pr: + runs-on: ubuntu-latest + steps: + + - name: Check out local repository + uses: actions/checkout@v4 + + # Set up a Python environment + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + # Clone dev version of probeinterface + - name: Clone external repository + run: | + # --- USER ACTION REQUIRED --- + # Replace this URL with the repository you want to clone. + # If it's a private repo, your GH_PAT must have access. + git clone https://github.com/spikeinterface/probeinterface ./probeinterface + + - name: Install probeinterface and matplotlib + run: pip install ./probeinterface matplotlib + + - name: Generate full NP library + run: | + cd scripts/ + python ../probeinterface/resources/generate_neuropixels_library.py + + # Check for any new probes + - name: Run local script + run: | + rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/ + rm -r scripts/neuropixels_library_generated/ + rm -r ./probeinterface + + - name: Commit changes if any + id: commit + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + git add imec/* + + # Only commit if there are changes + if git diff --staged --quiet; then + echo "No changes to commit" + echo "changes=false" >> $GITHUB_OUTPUT + else + git commit -m "Update json files for NP probes" + echo "changes=true" >> $GITHUB_OUTPUT + fi + + - name: Create pull request to add probes + if: steps.commit.outputs.changes == 'true' + uses: peter-evans/create-pull-request@v7 + with: + title: "Update Neuropixels json files" + body: "This PR updates the Neuropixel probes in probeinterace library, based on new data from the ProbeTable repository or because of a new ProbeInterface release." + branch-suffix: short-commit-hash + base: "main" diff --git a/.github/workflows/check_for_new_probes.yml b/.github/workflows/check_for_new_probes.yml index 47683d8..329ce71 100644 --- a/.github/workflows/check_for_new_probes.yml +++ b/.github/workflows/check_for_new_probes.yml @@ -43,9 +43,6 @@ jobs: # Check for any new probes - name: Run local script run: | - # --- USER ACTION REQUIRED --- - # Replace this path with the correct path to your local script - ls cd scripts/ python check_for_new_NP_probes.py rm -r neuropixels_library_generated/ From a2c919770da4b28293e7108982d773a9730600f0 Mon Sep 17 00:00:00 2001 From: chrishalcrow Date: Wed, 29 Oct 2025 17:06:40 +0000 Subject: [PATCH 2/2] remove unnecessary comments --- .github/workflows/check_for_changes_in_NP_jsons.yml | 3 --- .github/workflows/check_for_new_probes.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/check_for_changes_in_NP_jsons.yml b/.github/workflows/check_for_changes_in_NP_jsons.yml index 37ff53d..a640fa2 100644 --- a/.github/workflows/check_for_changes_in_NP_jsons.yml +++ b/.github/workflows/check_for_changes_in_NP_jsons.yml @@ -27,9 +27,6 @@ jobs: # Clone dev version of probeinterface - name: Clone external repository run: | - # --- USER ACTION REQUIRED --- - # Replace this URL with the repository you want to clone. - # If it's a private repo, your GH_PAT must have access. git clone https://github.com/spikeinterface/probeinterface ./probeinterface - name: Install probeinterface and matplotlib diff --git a/.github/workflows/check_for_new_probes.yml b/.github/workflows/check_for_new_probes.yml index 329ce71..77f3440 100644 --- a/.github/workflows/check_for_new_probes.yml +++ b/.github/workflows/check_for_new_probes.yml @@ -27,9 +27,6 @@ jobs: # Clone dev version of probeinterface - name: Clone external repository run: | - # --- USER ACTION REQUIRED --- - # Replace this URL with the repository you want to clone. - # If it's a private repo, your GH_PAT must have access. git clone https://github.com/spikeinterface/probeinterface ./probeinterface - name: Install probeinterface and matplotlib