ci: add automated weekly test matrix updates

Add automation to keep the pytest test matrix up-to-date with latest
Home Assistant Core releases:

1. **Weekly Automation**: New workflow updates test matrix automatically
2. **Version Fetcher**: Python script queries GitHub API for latest HA Core releases
3. **PR Creation**: Automatically creates PRs when new versions are available

## Benefits
- No more manual updates when new HA Core versions are released
- Automatic tracking of new HA Core releases
- Reduces maintenance burden

## Background
This builds on commit a982acb which fixed mypy-dev pinning. While upstream
now installs latest mypy-dev automatically, the test matrix versions still
need manual updates. This automation solves that remaining manual task.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Lenucksi 2025-11-30 10:49:12 +01:00 committed by Bas Nijholt
commit cc25a50401
2 changed files with 206 additions and 0 deletions

View file

@ -0,0 +1,59 @@
name: Update Test Matrix
on:
schedule:
# Run weekly on Monday at 9:00 UTC
- cron: "0 9 * * 1"
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
pull-requests: write
jobs:
update-matrix:
name: Update HA Core versions in test matrix
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Update test matrix
run: python scripts/update-test-matrix.py
- name: Check for changes
id: changes
run: |
if git diff --quiet .github/workflows/pytest.yaml; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "Detected changes:"
git diff .github/workflows/pytest.yaml
fi
- name: Create Pull Request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "ci: update HA Core test matrix versions"
title: "ci: Update Home Assistant Core test matrix"
body: |
This PR automatically updates the pytest workflow to test against the latest Home Assistant Core versions.
## Changes
- Updated HA Core versions in the test matrix to include latest patch releases
---
🤖 Generated automatically by the update-test-matrix workflow
branch: update-test-matrix
delete-branch: true
labels: |
automation
ci