Skip to content

Commit 5cf94ab

Browse files
committed
add look for json changes action
1 parent 9279b69 commit 5cf94ab

File tree

2 files changed

+74
-3
lines changed

2 files changed

+74
-3
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Check for changes in NP json files
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * 2' # Every Tuesday at 00:00 UTC
6+
workflow_dispatch:
7+
8+
# Grant permissions for the job to write to contents (push) and create PRs.
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
build-and-pr:
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- name: Check out local repository
19+
uses: actions/checkout@v4
20+
21+
# Set up a Python environment
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.10'
26+
27+
# Clone dev version of probeinterface
28+
- name: Clone external repository
29+
run: |
30+
# --- USER ACTION REQUIRED ---
31+
# Replace this URL with the repository you want to clone.
32+
# If it's a private repo, your GH_PAT must have access.
33+
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
34+
35+
- name: Install probeinterface and matplotlib
36+
run: pip install ./probeinterface matplotlib
37+
38+
- name: Generate full NP library
39+
run: |
40+
cd scripts/
41+
python ../probeinterface/resources/generate_neuropixels_library.py
42+
43+
# Check for any new probes
44+
- name: Run local script
45+
run: |
46+
rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/
47+
rm -r scripts/neuropixels_library_generated/
48+
rm -r ./probeinterface
49+
50+
- name: Commit changes if any
51+
id: commit
52+
run: |
53+
git config --local user.email "[email protected]"
54+
git config --local user.name "GitHub Action"
55+
56+
git add imec/*
57+
58+
# Only commit if there are changes
59+
if git diff --staged --quiet; then
60+
echo "No changes to commit"
61+
echo "changes=false" >> $GITHUB_OUTPUT
62+
else
63+
git commit -m "Update json files for NP probes"
64+
echo "changes=true" >> $GITHUB_OUTPUT
65+
fi
66+
67+
- name: Create pull request to add probes
68+
if: steps.commit.outputs.changes == 'true'
69+
uses: peter-evans/create-pull-request@v7
70+
with:
71+
title: "Update Neuropixels json files"
72+
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."
73+
branch-suffix: short-commit-hash
74+
base: "main"

.github/workflows/check_for_new_probes.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ jobs:
4343
# Check for any new probes
4444
- name: Run local script
4545
run: |
46-
# --- USER ACTION REQUIRED ---
47-
# Replace this path with the correct path to your local script
48-
ls
4946
cd scripts/
5047
python check_for_new_NP_probes.py
5148
rm -r neuropixels_library_generated/

0 commit comments

Comments
 (0)