Skip to content

Commit 4196ff9

Browse files
authored
Add look for json changes action (#29)
1 parent a45589f commit 4196ff9

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
31+
32+
- name: Install probeinterface and matplotlib
33+
run: pip install ./probeinterface matplotlib
34+
35+
- name: Generate full NP library
36+
run: |
37+
cd scripts/
38+
python ../probeinterface/resources/generate_neuropixels_library.py
39+
40+
# Check for any new probes
41+
- name: Run local script
42+
run: |
43+
rsync -av --include='*/' --include='*.json' --exclude='*' scripts/neuropixels_library_generated/ imec/
44+
rm -r scripts/neuropixels_library_generated/
45+
rm -r ./probeinterface
46+
47+
- name: Commit changes if any
48+
id: commit
49+
run: |
50+
git config --local user.email "[email protected]"
51+
git config --local user.name "GitHub Action"
52+
53+
git add imec/*
54+
55+
# Only commit if there are changes
56+
if git diff --staged --quiet; then
57+
echo "No changes to commit"
58+
echo "changes=false" >> $GITHUB_OUTPUT
59+
else
60+
git commit -m "Update json files for NP probes"
61+
echo "changes=true" >> $GITHUB_OUTPUT
62+
fi
63+
64+
- name: Create pull request to add probes
65+
if: steps.commit.outputs.changes == 'true'
66+
uses: peter-evans/create-pull-request@v7
67+
with:
68+
title: "Update Neuropixels json files"
69+
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."
70+
branch-suffix: short-commit-hash
71+
base: "main"

.github/workflows/check_for_new_probes.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ jobs:
2727
# Clone dev version of probeinterface
2828
- name: Clone external repository
2929
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.
3330
git clone https://github.com/spikeinterface/probeinterface ./probeinterface
3431
3532
- name: Install probeinterface and matplotlib
@@ -43,9 +40,6 @@ jobs:
4340
# Check for any new probes
4441
- name: Run local script
4542
run: |
46-
# --- USER ACTION REQUIRED ---
47-
# Replace this path with the correct path to your local script
48-
ls
4943
cd scripts/
5044
python check_for_new_NP_probes.py
5145
rm -r neuropixels_library_generated/

0 commit comments

Comments
 (0)