mirror of
https://github.com/alexhopeoconnor/default.git
synced 2026-10-20 01:41:30 +10:00
New Github actions (#481)
* Test new check * Add quote * test * test * move check * move back * use env * test multistep * test trigger * if: github.event.label.name * quotes * hassfest? * Fix clone * Update hassfest * check hassfest * Use real domain * Lmit * Test hassfest * Check domain * Fix domain * No changes * Enable on unlable * Change HACS validate * Move inputs * Add dummy integration * TEst * Move to env * Fix repo * Remove entry
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import json
|
||||
|
||||
|
||||
DEFAULT = "/tmp/default"
|
||||
|
||||
CATEGORIES = [
|
||||
"appdaemon",
|
||||
"integration",
|
||||
"netdaemon",
|
||||
"plugin",
|
||||
"python_script",
|
||||
"theme",
|
||||
]
|
||||
|
||||
CURRENT = {}
|
||||
CHANGED = {}
|
||||
|
||||
|
||||
def get_category():
|
||||
for category in CATEGORIES:
|
||||
with open(f"{DEFAULT}/{category}", "r") as default:
|
||||
CURRENT[category] = json.loads(default.read())
|
||||
|
||||
for category in CATEGORIES:
|
||||
with open(category, "r") as default:
|
||||
CHANGED[category] = json.loads(default.read())
|
||||
|
||||
for category in CATEGORIES:
|
||||
for repo in CURRENT[category]:
|
||||
if repo in CHANGED[category]:
|
||||
CHANGED[category].remove(repo)
|
||||
|
||||
changed = []
|
||||
for category in CATEGORIES:
|
||||
if CHANGED[category]:
|
||||
changed.append(category)
|
||||
|
||||
if len(changed) != 1:
|
||||
print(f"Bad data {changed}")
|
||||
exit(1)
|
||||
|
||||
return changed.pop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_category())
|
||||
@@ -0,0 +1,27 @@
|
||||
import json
|
||||
from scripts.changed.category import get_category
|
||||
|
||||
DEFAULT = "/tmp/default"
|
||||
|
||||
|
||||
def get_repo():
|
||||
category = get_category()
|
||||
with open(f"{DEFAULT}/{category}", "r") as default:
|
||||
current = json.loads(default.read())
|
||||
|
||||
with open(category, "r") as default:
|
||||
new = json.loads(default.read())
|
||||
|
||||
for repo in current:
|
||||
if repo in new:
|
||||
new.remove(repo)
|
||||
|
||||
if len(new) != 1:
|
||||
print(f"Bad data {new}")
|
||||
exit(1)
|
||||
|
||||
return new.pop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_repo())
|
||||
Reference in New Issue
Block a user