Skip to content

Validate with hassfest #131

Validate with hassfest

Validate with hassfest #131

Workflow file for this run

name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate integration
steps:
- name: Check out repository
uses: "actions/checkout@v6"
- name: Validate with hassfest
uses: "home-assistant/actions/hassfest@master"
- name: Validate HACS
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands
- name: Check if translations are up to date
run: |
# Check that all translation files have the same structure
python3 -c "
import json
import os
translations_dir = 'custom_components/snmp_printer/translations'
en_file = os.path.join(translations_dir, 'en.json')
if not os.path.exists(en_file):
print('English translation file not found')
exit(1)
with open(en_file, 'r') as f:
en_keys = set(json.dumps(json.load(f), sort_keys=True).replace('English', 'PLACEHOLDER').replace('SNMP Printer Integration', 'TITLE_PLACEHOLDER'))
for file in os.listdir(translations_dir):
if file.endswith('.json') and file != 'en.json':
filepath = os.path.join(translations_dir, file)
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Basic structure validation - should have same keys
try:
json.loads(content)
print(f'✓ {file} is valid JSON')
except json.JSONDecodeError as e:
print(f'✗ {file} has invalid JSON: {e}')
exit(1)
print('All translation files are valid')
"