mirror of
https://github.com/alexhopeoconnor/default.git
synced 2026-10-16 16:01:37 +10:00
Change action (#708)
This commit is contained in:
@@ -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())
|
||||
@@ -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())
|
||||
@@ -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()
|
||||
@@ -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())
|
||||
@@ -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()
|
||||
@@ -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 "<img" in info or "![" in info:
|
||||
print("Has image(s)")
|
||||
return
|
||||
|
||||
exit("::error::There should be images to show the user what they get.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
check()
|
||||
@@ -1,13 +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-info")
|
||||
info = get_info()
|
||||
if not info:
|
||||
exit("::error::No information provided.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
check()
|
||||
@@ -1,38 +0,0 @@
|
||||
from scripts.changed.category import get_category
|
||||
from scripts.helpers.manifest import get_manifest
|
||||
from scripts.helpers.integration_path import get_integration_path
|
||||
|
||||
|
||||
def check():
|
||||
print("Information: https://hacs.xyz/docs/publish/include#check-manifest")
|
||||
if get_category() != "integration":
|
||||
print("Only integrations are checked.")
|
||||
return
|
||||
|
||||
fail = "::error::Missing required value for key '{key}' in {path}"
|
||||
integration = get_integration_path()
|
||||
path = f"{integration.replace('/tmp/repositories/addition/', '')}/manifest.json"
|
||||
|
||||
manifest = get_manifest()
|
||||
issues = []
|
||||
|
||||
if manifest.get("domain") is None or manifest.get("domain") == "":
|
||||
issues.append(fail.format(key="domain", path=path))
|
||||
|
||||
if manifest.get("documentation") is None or manifest.get("documentation") == "":
|
||||
issues.append(fail.format(key="documentation", path=path))
|
||||
|
||||
if manifest.get("issue_tracker") is None or manifest.get("issue_tracker") == "":
|
||||
issues.append(fail.format(key="issue_tracker", path=path))
|
||||
|
||||
if manifest.get("codeowners") is None:
|
||||
issues.append(fail.format(key="codeowners", path=path))
|
||||
|
||||
if issues:
|
||||
for issue in issues:
|
||||
print(issue)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
check()
|
||||
@@ -1,40 +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-repository")
|
||||
repo = get_repo()
|
||||
issues = []
|
||||
async with GitHub(TOKEN) as github:
|
||||
repository = await github.get_repo(repo)
|
||||
repo = repository.attributes
|
||||
|
||||
if not repo["has_issues"]:
|
||||
issues.append("::error::Issues not enabled.")
|
||||
|
||||
if not repo["description"]:
|
||||
issues.append(
|
||||
"::error::No description. (https://hacs.xyz/docs/publish/start#description)"
|
||||
)
|
||||
|
||||
if not repo["topics"]:
|
||||
issues.append(
|
||||
"::error::No topics. (https://hacs.xyz/docs/publish/start#topics)"
|
||||
)
|
||||
|
||||
if issues:
|
||||
for issue in issues:
|
||||
print(issue)
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.get_event_loop().run_until_complete(check())
|
||||
@@ -1,47 +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-wheels")
|
||||
if get_category() != "integration":
|
||||
print("Only integrations are checked.")
|
||||
return
|
||||
|
||||
manifest = get_manifest()
|
||||
|
||||
domain = manifest.get("domain")
|
||||
requirements = manifest.get("requirements")
|
||||
if domain is None:
|
||||
exit("No domain")
|
||||
|
||||
if not requirements:
|
||||
print("No requirements found")
|
||||
return
|
||||
|
||||
async with GitHub(TOKEN) as github:
|
||||
repository = await github.get_repo("home-assistant/wheels-custom-integrations")
|
||||
files = await repository.get_contents("components")
|
||||
components = [x.attributes["name"] for x in files]
|
||||
if domain in components or f"{domain}.json" in components:
|
||||
print(
|
||||
f"{domain} is added to https://github.com/home-assistant/wheels-custom-integrations, NICE!"
|
||||
)
|
||||
return
|
||||
exit(
|
||||
f"::error::{domain} is not added to https://github.com/home-assistant/wheels-custom-integrations, "
|
||||
+ "this is needed to ensure the best possible experience for the user"
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.get_event_loop().run_until_complete(check())
|
||||
Reference in New Issue
Block a user