mirror of
https://github.com/alexhopeoconnor/default.git
synced 2026-10-22 10:42:11 +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,12 @@
|
||||
import json
|
||||
import os
|
||||
from glob import glob
|
||||
from scripts.helpers.manifest import get_manifest
|
||||
|
||||
def get_domain():
|
||||
manifest = get_manifest()
|
||||
return manifest.get('domain')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_domain())
|
||||
@@ -0,0 +1,21 @@
|
||||
import json
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
|
||||
def get_hacs_manifest():
|
||||
files = []
|
||||
for dir, _, _ in os.walk("/tmp/addition"):
|
||||
files.extend(glob(os.path.join(dir, "*hacs.json")))
|
||||
|
||||
if len(files) != 1:
|
||||
print("No HACS manifest")
|
||||
exit(1)
|
||||
|
||||
hacs_manifest = files.pop()
|
||||
print(f"Found HACS manifest at {hacs_manifest.replace('/tmp/addition','')}")
|
||||
|
||||
with open(hacs_manifest, "r") as mf:
|
||||
hacs_manifest = json.loads(mf.read())
|
||||
|
||||
return hacs_manifest or {}
|
||||
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
from scripts.helpers.hacs_manifest import get_hacs_manifest
|
||||
|
||||
ALTERNATIVES = {
|
||||
"info": ["info", "INFO", "info.md", "INFO.md", "info.MD", "INFO.MD"],
|
||||
"readme": ["readme", "README", "readme.md", "README.md", "readme.MD", "README.MD"],
|
||||
}
|
||||
|
||||
|
||||
def get_info():
|
||||
manifest = get_hacs_manifest()
|
||||
info = "readme" if manifest.get("render_readme", False) else "info"
|
||||
|
||||
content = ""
|
||||
|
||||
for alternative in ALTERNATIVES[info]:
|
||||
if os.path.exists(f"/tmp/addition/{alternative}"):
|
||||
print(f"Found info file at /{alternative}")
|
||||
with open(f"/tmp/addition/{alternative}", "r") as alt:
|
||||
content = alt.read()
|
||||
return content
|
||||
@@ -0,0 +1,16 @@
|
||||
import json
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
def get_integration_path():
|
||||
files = []
|
||||
for dir, _, _ in os.walk("/tmp/addition"):
|
||||
files.extend(glob(os.path.join(dir, "*manifest.json")))
|
||||
|
||||
if len(files) != 1:
|
||||
print("No manifest")
|
||||
exit(1)
|
||||
return files.pop().replace("/manifest.json", "")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_integration_path())
|
||||
@@ -0,0 +1,11 @@
|
||||
import json
|
||||
import os
|
||||
from glob import glob
|
||||
from scripts.helpers.integration_path import get_integration_path
|
||||
|
||||
def get_manifest():
|
||||
manifest = f"{get_integration_path()}/manifest.json"
|
||||
with open(manifest, "r") as mf:
|
||||
manifest = json.loads(mf.read())
|
||||
|
||||
return manifest or {}
|
||||
Reference in New Issue
Block a user