Add check for removed repository (#2880)

This commit is contained in:
Joakim Sørensen
2024-12-04 14:16:34 +01:00
committed by GitHub
parent a4fd3f06c7
commit f19829033a
3 changed files with 44 additions and 1 deletions
+20
View File
@@ -104,6 +104,26 @@ jobs:
- name: Run the check - name: Run the check
run: python3 -m scripts.check.edits run: python3 -m scripts.check.edits
removed:
runs-on: ubuntu-latest
name: Removed repository
steps:
- name: Check out repository
uses: actions/checkout@v4.2.1
- name: Set up Python
uses: actions/setup-python@v5.2.0
with:
python-version-file: ".python-version"
cache: "pip"
cache-dependency-path: "requirements.txt"
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.removed
hassfest: hassfest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Hassfest name: Hassfest
+2 -1
View File
@@ -1 +1,2 @@
aiogithubapi==21.11.0 aiogithubapi==21.11.0
requests==2.32.3
+22
View File
@@ -0,0 +1,22 @@
import asyncio
import os
import requests
CHECKURL = "https://data-v2.hacs.xyz/removed/repositories.json"
async def check():
repo = os.environ["REPOSITORY"].lower()
try:
removed_repositories = set(x.lower() for x in requests.get(CHECKURL).json())
if repo in removed_repositories:
exit(f"::error::'{repo}' has been removed from HACS")
except Exception as e:
exit(f"::error::{e}")
print("Repository not removed from HACS")
if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(check())