forked from EnviroDIY/ModularSensors
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpre-commit-check-deps.py
29 lines (23 loc) · 994 Bytes
/
pre-commit-check-deps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
import subprocess
# Open the current library.json file
library_json = open(
"C:\\Users\\sdamiano\\Documents\\GitHub\\EnviroDIY\\ModularSensors\\library.json",
)
library_data = json.load(library_json)
# Open the current library.json file
dependency_json = open(
"C:\\Users\\sdamiano\\Documents\\GitHub\\EnviroDIY\\ModularSensors\\continuous_integration\\dependencies.json",
)
dependency_data = json.load(dependency_json)
lib_dependencies = library_data["dependencies"]
out_dependencies = dependency_data["dependencies"]
if lib_dependencies != out_dependencies:
dependency_data["action_cache_version"] += 1
dependency_data["dependencies"] = library_data["dependencies"]
with open(
"C:\\Users\\sdamiano\\Documents\\GitHub\\EnviroDIY\\ModularSensors\\continuous_integration\\dependencies.json",
"w",
) as outfile:
json.dump(dependency_data, outfile, indent=2)
subprocess.run("git add continuous_integration\\dependencies.json")