Add preflight (#490)

* Add preflight

* fix syntax

* move check

* get event

* print

* return event

* use path

* tt

* move to helper

* add issue_comment

* remove should run

* check owner

* add more information to the logs

* test

* add finished

* move keys

* Update errors

* remove repo

* fix JQ run

* filter
This commit is contained in:
Joakim Sørensen
2020-05-28 16:53:45 +02:00
committed by GitHub
parent 51639d6624
commit 9e8788c060
19 changed files with 135 additions and 89 deletions
+9
View File
@@ -0,0 +1,9 @@
import os
import json
def get_event():
with open(os.getenv("GITHUB_EVENT_PATH"), "r") as event_data:
event = json.loads(event_data.read())
return event
+4 -2
View File
@@ -5,7 +5,7 @@ from glob import glob
def get_hacs_manifest():
files = []
for dir, _, _ in os.walk("/tmp/addition"):
for dir, _, _ in os.walk("/tmp/repositories/addition"):
files.extend(glob(os.path.join(dir, "*hacs.json")))
if len(files) != 1:
@@ -13,7 +13,9 @@ def get_hacs_manifest():
exit(1)
hacs_manifest = files.pop()
print(f"Found HACS manifest at {hacs_manifest.replace('/tmp/addition','')}")
print(
f"Found HACS manifest at {hacs_manifest.replace('/tmp/repositories/addition','')}"
)
with open(hacs_manifest, "r") as mf:
hacs_manifest = json.loads(mf.read())
+2 -2
View File
@@ -14,8 +14,8 @@ def get_info():
content = ""
for alternative in ALTERNATIVES[info]:
if os.path.exists(f"/tmp/addition/{alternative}"):
if os.path.exists(f"/tmp/repositories/addition/{alternative}"):
print(f"Found info file at /{alternative}")
with open(f"/tmp/addition/{alternative}", "r") as alt:
with open(f"/tmp/repositories/addition/{alternative}", "r") as alt:
content = alt.read()
return content
+1 -1
View File
@@ -5,7 +5,7 @@ from glob import glob
def get_integration_path():
files = []
for dir, _, _ in os.walk("/tmp/addition"):
for dir, _, _ in os.walk("/tmp/repositories/addition"):
files.extend(glob(os.path.join(dir, "*manifest.json")))
if len(files) != 1: