Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AWTRIX3 and E-Flux plugins + url validation via github workflows #47

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/scripts/validate_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import json
import requests
import sys

def validate_plugins(file_path):
try:
with open(file_path, 'r') as file:
plugins = json.load(file)
except (FileNotFoundError, json.JSONDecodeError) as e:
print(f"Error reading plugins.json: {e}")
sys.exit(1)

valid_urls = []
broken_urls = []

for key, plugin in plugins.items():
url = plugin.get('repository') # Use `.get()` to avoid KeyError
if not url or not url.startswith(("http://", "https://")):
print(f"Invalid or missing URL for plugin {key}: {url}")
broken_urls.append((key, url))
continue

try:
response = requests.get(url, timeout=10) # Add timeout
if response.status_code == 200:
print(f"Valid URL: {url}")
valid_urls.append(url)
else:
print(f"Broken URL: {url} (HTTP {response.status_code})")
broken_urls.append((key, url))
except requests.exceptions.RequestException as e:
print(f"Broken URL: {url} - Exception: {e}")
broken_urls.append((key, url))

# Output summary
print("\nValidation Summary:")
print(f"Valid URLs: {len(valid_urls)}")
print(f"Broken URLs: {len(broken_urls)}")

# Exit with non-zero status code if broken URLs are found
if broken_urls:
sys.exit(1)

if __name__ == "__main__":
validate_plugins('plugins.json')
32 changes: 32 additions & 0 deletions .github/workflows/validate-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Validate Plugins

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: # Allows manual trigger

jobs:
validate-plugins:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests

- name: Validate plugins.json
run: |
python .github/scripts/validate_plugins.py
104 changes: 16 additions & 88 deletions plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
"name": "DomoticzCrowAlarm",
"repository": "https://github.com/febalci/DomoticzCrowAlarm"
},
"AWTRIX3": {
"author": "galadril",
"branch": "master",
"description": "AWTRIX3 Smart Clock",
"folder": "Domoticz-AWTRIX3-Plugin",
"name": "AWTRIX3",
"repository": "https://github.com/galadril/Domoticz-AWTRIX3-Plugin"
},
"BatteryLevel": {
"author": "999LV",
"branch": "master",
Expand Down Expand Up @@ -71,6 +79,14 @@
"name": "Dyson Pure Link",
"repository": "https://github.com/JanJaapKo/DysonPureLink"
},
"E-Flux": {
"author": "galadril",
"branch": "master",
"description": "'E-Flux by Road' back office of your EV Charger",
"folder": "Domoticz-E-Flux-Plugin",
"name": "E-Flux",
"repository": "https://github.com/galadril/Domoticz-E-Flux-Plugin"
},
"EmmetiEQ2021": {
"author": "CreasolTech",
"branch": "master",
Expand Down Expand Up @@ -159,14 +175,6 @@
"name": "Domoticz-Itho-Wifi-Plugin",
"repository": "https://github.com/galadril/Domoticz-Itho-Wifi-Plugin"
},
"KiaUVOHyundaiBlueLink": {
"author": "CreasolTech",
"branch": "master",
"description": "Kia UVO and Hyundai BlueLink vehicles",
"folder": "domoticz-kia-hyundai",
"name": "Kia UVO and Hyundai BlueLink vehicles plugin",
"repository": "https://github.com/CreasolTech/domoticz-kia-hyundai"
},
"Kodi": {
"author": "dnpwwo",
"branch": "master",
Expand All @@ -175,14 +183,6 @@
"name": "Kodi Players",
"repository": "https://github.com/dnpwwo/Domoticz-Kodi-Plugin"
},
"Life360": {
"author": "febalci",
"branch": "master",
"description": "Life 360 Presence",
"folder": "Life360",
"name": "DomoticzLife360",
"repository": "https://github.com/febalci/DomoticzLife360"
},
"Linky": {
"author": "guillaumezin",
"branch": "master",
Expand Down Expand Up @@ -247,14 +247,6 @@
"name": "domoticz-onkyo-plugin",
"repository": "https://github.com/jorgh6/domoticz-onkyo-plugin"
},
"PioneerAVR": {
"author": "febalci",
"branch": "master",
"description": "Pioneer AVR",
"folder": "PioneerAVR",
"name": "DomoticzPioneerAVR",
"repository": "https://github.com/febalci/DomoticzPioneerAVR"
},
"PZEM-016": {
"author": "CreasolTech",
"branch": "master",
Expand Down Expand Up @@ -295,14 +287,6 @@
"name": "GPIO-SYSFS-Switches",
"repository": "https://github.com/flatsiedatsie/GPIO-SYSFS-Switches"
},
"SeismicPortal": {
"author": "febalci",
"branch": "master",
"description": "Eartquake EMSC Data",
"folder": "SeismicPortal",
"name": "DomoticzEarthquake",
"repository": "https://github.com/febalci/DomoticzEarthquake"
},
"Shelly_MQTT": {
"author": "enesbcs",
"branch": "master",
Expand Down Expand Up @@ -375,14 +359,6 @@
"name": "WAN-IP-CHECKER",
"repository": "https://github.com/ycahome/WAN-IP-CHECKER"
},
"XiaomiPM": {
"author": "febalci",
"branch": "master",
"description": "Xiaomi PM2.5 Sensor",
"folder": "XiaomiPM",
"name": "Xiaomi PM2.5 Sensor",
"repository": "https://github.com/febalci/DomoticzXiaomiPM2.5"
},
"YamahaPlug": {
"author": "thomas-villagers",
"branch": "master",
Expand Down Expand Up @@ -503,54 +479,6 @@
"name": "sony-bravia",
"repository": "https://github.com/gerard33/sony-bravia"
},
"xfr-pimonitor": {
"author": "Xorfor",
"branch": "master",
"description": "PiMonitor",
"folder": "xfr-pimonitor",
"name": "Domoticz-PiMonitor-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-PiMonitor-Plugin"
},
"xfr_aardbeving": {
"author": "Xorfor",
"branch": "master",
"description": "Dutch earthquakes",
"folder": "xfr_aardbeving",
"name": "Domoticz-LastDutchEarthquake-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-LastDutchEarthquake-Plugin"
},
"xfr_discusage": {
"author": "Xorfor",
"branch": "master",
"description": "Disc usage",
"folder": "xfr_discusage",
"name": "Domoticz-Disc-usage-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-Disc-usage-Plugin"
},
"xfr_openaq": {
"author": "Xorfor",
"branch": "master",
"description": "OpenAQ",
"folder": "xfr_openaq",
"name": "Domoticz-OpenAQ-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-OpenAQ-Plugin"
},
"xfr_pihole": {
"author": "Xorfor",
"branch": "master",
"description": "Pi-hole summary",
"folder": "xfr_pihole",
"name": "Domoticz-Pi-hole-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-Pi-hole-Plugin"
},
"xfr_speedtest": {
"author": "Xorfor",
"branch": "master",
"description": "Speedtest",
"folder": "xfr_speedtest",
"name": "Domoticz-Speedtest-Plugin",
"repository": "https://github.com/Xorfor/Domoticz-Speedtest-Plugin"
},
"WLANThermo": {
"author": "galadril",
"branch": "master",
Expand Down