diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d826bae..1ceb71d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -37,24 +37,10 @@ jobs: name: repositories path: /tmp/repositories - matrix: + owner: runs-on: ubuntu-latest - name: ${{ matrix.checks.name }} + name: Check Owner needs: preflight - strategy: - fail-fast: False - matrix: - checks: - - { check: "archived", name: "Check Archived", deps: True } - - { check: "brands", name: "Check Brands", deps: True } - - { check: "fork", name: "Check Fork", deps: True } - - { check: "hacs_manifest", name: "Check HACS Manifest" } - - { check: "images", name: "Check Images" } - - { check: "info", name: "Check Info" } - - { check: "manifest", name: "Check Manifest" } - - { check: "owner", name: "Check Owner", deps: True } - - { check: "repository", name: "Check Repository", deps: True } - - { check: "wheels", name: "Check Wheels", deps: True } steps: - name: Check out repository uses: actions/checkout@v2 @@ -66,11 +52,10 @@ jobs: path: /tmp/repositories - name: Install dependencies if needed - if: matrix.checks.deps run: make init - name: Run the check - run: python3 -m scripts.check.${{ matrix.checks.check }} + run: python3 -m scripts.check.owner env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -112,24 +97,9 @@ jobs: --action validate \ --integration-path /$domain \ " - hacs: runs-on: ubuntu-latest - name: "Check HACS" - needs: preflight - steps: - - name: HACS validation - uses: "hacs/integration/action@main" - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - env: - REPOSITORY: ${{needs.preflight.outputs.repository}} - CATEGORY: ${{needs.preflight.outputs.category}} - - - hacs-new: - runs-on: ubuntu-latest - name: "Run HACS action" + name: "Run HACS Action" needs: preflight steps: - name: HACS action diff --git a/scripts/check/archived.py b/scripts/check/archived.py deleted file mode 100644 index a067171..0000000 --- a/scripts/check/archived.py +++ /dev/null @@ -1,24 +0,0 @@ -import asyncio -import json -import os -from glob import glob - -from aiogithubapi import GitHub -from scripts.changed.repo import get_repo - -TOKEN = os.getenv("GITHUB_TOKEN") - - -async def check(): - print("Information: https://hacs.xyz/docs/publish/include#check-archived") - repo = get_repo() - async with GitHub(TOKEN) as github: - repository = await github.get_repo(repo) - repo = repository.attributes - - if repo["archived"]: - exit("::error::Repository is archived") - - -if __name__ == "__main__": - asyncio.get_event_loop().run_until_complete(check()) diff --git a/scripts/check/brands.py b/scripts/check/brands.py deleted file mode 100644 index aaa1a66..0000000 --- a/scripts/check/brands.py +++ /dev/null @@ -1,44 +0,0 @@ -import asyncio -import json -import os -from glob import glob - -from aiogithubapi import GitHub -from scripts.changed.category import get_category -from scripts.changed.repo import get_repo -from scripts.helpers.manifest import get_manifest - -TOKEN = os.getenv("GITHUB_TOKEN") - - -async def check(): - print("Information: https://hacs.xyz/docs/publish/include#check-brands") - if get_category() != "integration": - print("Only integrations are checked.") - return - - manifest = get_manifest() - domain = manifest.get("domain") - - if domain is None: - print("No domain") - exit(1) - - async with GitHub(TOKEN) as github: - repository = await github.get_repo("home-assistant/brands") - core = await repository.get_contents("core_integrations") - custom = await repository.get_contents("custom_integrations") - - if domain not in [x.attributes["name"] for x in core + custom]: - exit( - f"::error::{domain} is not added to https://github.com/home-assistant/brands, " - + "this is needed to ensure the best possible experience for the user" - ) - else: - print( - f"{domain} is added to https://github.com/home-assistant/brands, NICE!" - ) - - -if __name__ == "__main__": - asyncio.get_event_loop().run_until_complete(check()) diff --git a/scripts/check/finished.py b/scripts/check/finished.py deleted file mode 100644 index 3ce96ea..0000000 --- a/scripts/check/finished.py +++ /dev/null @@ -1,14 +0,0 @@ -from scripts.helpers.event import get_event - - -def check(): - event = get_event() - labels = event.get("pull_request", {}).get("labels", []) - - for label in labels: - if label["name"] == "Not finished": - exit("::error::Pull request is not ready for CI runs") - - -if __name__ == "__main__": - check() diff --git a/scripts/check/fork.py b/scripts/check/fork.py deleted file mode 100644 index 59a8ad0..0000000 --- a/scripts/check/fork.py +++ /dev/null @@ -1,24 +0,0 @@ -import asyncio -import json -import os -from glob import glob - -from aiogithubapi import GitHub -from scripts.changed.repo import get_repo - -TOKEN = os.getenv("GITHUB_TOKEN") - - -async def check(): - print("Information: https://hacs.xyz/docs/publish/include#check-fork") - repo = get_repo() - async with GitHub(TOKEN) as github: - repository = await github.get_repo(repo) - repo = repository.attributes - - if repo["fork"]: - exit("::warning:: {repo} is a fork") - - -if __name__ == "__main__": - asyncio.get_event_loop().run_until_complete(check()) diff --git a/scripts/check/hacs_manifest.py b/scripts/check/hacs_manifest.py deleted file mode 100644 index 5bfeee6..0000000 --- a/scripts/check/hacs_manifest.py +++ /dev/null @@ -1,26 +0,0 @@ -from scripts.changed.category import get_category -from scripts.helpers.hacs_manifest import get_hacs_manifest - - -def check(): - print("Information: https://hacs.xyz/docs/publish/include#check-hacs-manifest") - if get_category() != "integration": - print("Only integrations are checked.") - return - - manifest = get_hacs_manifest() - fail = "::error::Missing required value for key '{key}' in {path}" - path = "hacs.json" - issues = [] - - if manifest.get("name") is None: - issues.append(fail.format(key="name", path=path)) - - if issues: - for issue in issues: - print(issue) - exit(1) - - -if __name__ == "__main__": - check() diff --git a/scripts/check/images.py b/scripts/check/images.py deleted file mode 100644 index fab5d0c..0000000 --- a/scripts/check/images.py +++ /dev/null @@ -1,20 +0,0 @@ -from scripts.changed.category import get_category -from scripts.helpers.info import get_info - - -def check(): - print("Information: https://hacs.xyz/docs/publish/include#check-images") - if get_category() not in ["plugin", "theme"]: - print("Only plugin and theme are checked.") - return - - info = get_info() - if "