diff --git a/checks/requirements b/checks/requirements index d76eb4d..d1ae0e3 100644 --- a/checks/requirements +++ b/checks/requirements @@ -17,14 +17,16 @@ function checkCondition () { function checkRun () { repoPath=$(cat "$GITHUB_ACTION_PATH"/data/path) mkdir -p "$repoPath/requirements" - wget -q -O "$GITHUB_ACTION_PATH/helpers/requirements/validate_requirements.py" \ - https://raw.githubusercontent.com/home-assistant/wheels-custom-integrations/master/scripts/validate_requirements.py - cd "$GITHUB_ACTION_PATH/helpers/requirements" - jq -r .requirements "$GITHUB_ACTION_PATH/data/manifest.json" > ./requirements.json + git clone --depth 1 https://github.com/home-assistant/wheels-custom-integrations.git "$repoPath/wheels-custom-integrations" + cd "$repoPath/wheels-custom-integrations" + jq -r .requirements "$GITHUB_ACTION_PATH/data/manifest.json" > "$repoPath/wheels-custom-integrations/validate_requirements/requirements.json" jq . ./requirements.json - docker build . -t homeassistant/home-assistant:beta + cp "$GITHUB_ACTION_PATH/helpers/requirements/__init__.py" "$repoPath/wheels-custom-integrations/validate_requirements" + cp "$GITHUB_ACTION_PATH/helpers/requirements/run.sh" "$repoPath/wheels-custom-integrations/validate_requirements" + touch "$repoPath/wheels-custom-integrations/validate_requirements/files.json" + docker build -t validate -f validate_requirements/Dockerfile . set +e - docker run homeassistant/home-assistant:beta + docker run --rm validate requirements="$?" set -e if [ "${requirements}" == 0 ]; then diff --git a/helpers/requirements/__init__.py b/helpers/requirements/__init__.py index df0d672..3d79d63 100644 --- a/helpers/requirements/__init__.py +++ b/helpers/requirements/__init__.py @@ -15,7 +15,7 @@ def validate() -> bool: print() piped_input = sys.stdin.read() requirements = [] - with open("/entry/requirements/requirements.json", "r") as requirements_file: + with open("/action/validate/requirements.json", "r") as requirements_file: requirements = json.loads(requirements_file.read()) validated_ok = True print("Requirements to validate:", len(requirements)) diff --git a/helpers/requirements/run.sh b/helpers/requirements/run.sh new file mode 100644 index 0000000..f0b1736 --- /dev/null +++ b/helpers/requirements/run.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +mkdir -p /action +mv /validate /action/validate +cd /action || exit 1 +python3 -m validate \ No newline at end of file