Skip to content

Generate Cambridge Neurotech library #11

Generate Cambridge Neurotech library

Generate Cambridge Neurotech library #11

name: Generate Cambridge Neurotech library
on:
schedule:
- cron: '0 1 * * 1' # Every Monday at 01: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 repositories
run: |
# probeinterface
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
# cambridge neurotech probe maps
git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps
- name: Install probeinterface and dependencies
run: pip install ./probeinterface matplotlib pandas shapely openpyxl tqdm
- name: Generate full cambridge library and check for changes
run: |
cd scripts/
python ../probeinterface/resources/generate_cambridgeneurotech_library.py ../probe_maps/ --output-folder ./cambridge_library_generated/
# check for new probes
python check_for_new_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/
# check for json changes (except probeinterface version)
python check_for_json_changes_in_probes.py ../cambridgeneurotech/ ./cambridge_library_generated/ --copy-figures
# clean up
rm -r cambridge_library_generated/
cd ..
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 cambridgeneurotech/*
# 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 cambridge neurotech 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 Cambridge Neurotech json files"
body: "This PR updates the Cambridge Neurotech probes in probeinterace library, based on new data from the cambridge-neurotech/probe_maps repository or because of a new ProbeInterface release."
branch-suffix: short-commit-hash
base: "main"