Skip to content
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
170 changes: 170 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
name: Update Changelog

on:
push:
branches:
- main
workflow_dispatch: # Allow manual triggering

jobs:
update-changelog:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for changelog generation
token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate changelog from commits
id: changelog
run: |
# Get commits since last changelog commit (excluding changelog update commits)
LAST_CHANGELOG_COMMIT=$(git log --oneline --grep="update changelog" --grep="chore: update changelog" --invert-grep -1 --format="%H" || git rev-list --max-parents=0 HEAD)

echo "Checking commits since: $LAST_CHANGELOG_COMMIT"

# Get new commits (excluding this potential changelog commit)
COMMITS=$(git log --pretty=format:"%s" $LAST_CHANGELOG_COMMIT..HEAD --grep="update changelog" --grep="chore: update changelog" --invert-grep)

if [ -z "$COMMITS" ]; then
echo "No new commits found"
echo "has_changes=false" >> $GITHUB_OUTPUT
exit 0
fi

echo "has_changes=true" >> $GITHUB_OUTPUT

# Initialize changelog sections
ADDED=""
FIXED=""
CHANGED=""
REMOVED=""
SECURITY=""

# Process each commit
while IFS= read -r commit; do
echo "Processing: $commit"

case "$commit" in
feat:*|feat\(*\):*)
item=$(echo "$commit" | sed 's/^feat[^:]*: *//')
ADDED="${ADDED}- ${item}\n"
;;
fix:*|fix\(*\):*)
item=$(echo "$commit" | sed 's/^fix[^:]*: *//')
FIXED="${FIXED}- ${item}\n"
;;
docs:*|docs\(*\):*)
item=$(echo "$commit" | sed 's/^docs[^:]*: *//')
CHANGED="${CHANGED}- Documentation: ${item}\n"
;;
style:*|style\(*\):*|refactor:*|refactor\(*\):*|perf:*|perf\(*\):*)
item=$(echo "$commit" | sed 's/^[^:]*: *//')
CHANGED="${CHANGED}- ${item}\n"
;;
test:*|test\(*\):*|ci:*|ci\(*\):*|build:*|build\(*\):*)
item=$(echo "$commit" | sed 's/^[^:]*: *//')
CHANGED="${CHANGED}- Development: ${item}\n"
;;
chore:*|chore\(*\):*)
item=$(echo "$commit" | sed 's/^chore[^:]*: *//')
if [[ "$item" == *"remove"* || "$item" == *"delete"* ]]; then
REMOVED="${REMOVED}- ${item}\n"
else
CHANGED="${CHANGED}- ${item}\n"
fi
;;
*)
# Non-conventional commit
CHANGED="${CHANGED}- ${commit}\n"
;;
esac
done <<< "$COMMITS"

# Save sections to files for later use
echo -e "$ADDED" > /tmp/added.txt
echo -e "$FIXED" > /tmp/fixed.txt
echo -e "$CHANGED" > /tmp/changed.txt
echo -e "$REMOVED" > /tmp/removed.txt

- name: Update changelog file
if: steps.changelog.outputs.has_changes == 'true'
run: |
# Read the sections
ADDED=$(cat /tmp/added.txt)
FIXED=$(cat /tmp/fixed.txt)
CHANGED=$(cat /tmp/changed.txt)
REMOVED=$(cat /tmp/removed.txt)

# Create new unreleased section
NEW_SECTION=""

if [ ! -z "$ADDED" ] && [ "$ADDED" != "-" ]; then
NEW_SECTION="${NEW_SECTION}\n### Added\n${ADDED}"
fi

if [ ! -z "$FIXED" ] && [ "$FIXED" != "-" ]; then
NEW_SECTION="${NEW_SECTION}\n### Fixed\n${FIXED}"
fi

if [ ! -z "$CHANGED" ] && [ "$CHANGED" != "-" ]; then
NEW_SECTION="${NEW_SECTION}\n### Changed\n${CHANGED}"
fi

if [ ! -z "$REMOVED" ] && [ "$REMOVED" != "-" ]; then
NEW_SECTION="${NEW_SECTION}\n### Removed\n${REMOVED}"
fi

# Only update if we have actual content
if [ ! -z "$NEW_SECTION" ]; then
# Create backup
cp CHANGELOG.md CHANGELOG.md.bak

# Create new changelog
{
# Keep everything before [Unreleased]
sed '/^## \[Unreleased\]/,$d' CHANGELOG.md

# Add new [Unreleased] section
echo "## [Unreleased]"
echo -e "$NEW_SECTION"

# Add rest of changelog (skip old [Unreleased] section)
sed -n '/^## \[Unreleased\]/,/^## \[/{/^## \[Unreleased\]/d; /^## \[/!d;}; /^## \[/,$p' CHANGELOG.md
} > CHANGELOG.new.md

mv CHANGELOG.new.md CHANGELOG.md

echo "Changelog updated successfully"
else
echo "No conventional commits to add to changelog"
fi

- name: Check for actual changes
id: check-changes
run: |
if git diff --quiet CHANGELOG.md; then
echo "No changes to commit"
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "CHANGELOG.md has been updated"
echo "changes=true" >> $GITHUB_OUTPUT

echo "## Changes made:" >> $GITHUB_STEP_SUMMARY
echo '```diff' >> $GITHUB_STEP_SUMMARY
git diff CHANGELOG.md >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi

- name: Commit changelog updates
if: steps.check-changes.outputs.changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add CHANGELOG.md
git commit -m "chore: update changelog [skip ci]"
git push origin main
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.idea/
__pycache__/
.vscode/*
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Changelog support for Home Assistant updates
- Terminus fonts support

### Fixed
- Retain user input when config flow fails
- Add translations for error strings

### Changed
- Use uv for test dependency installation in CI
- Updated entity documentation in README
- Removed autoDim references from codebase
- Removed enable_app and disable_app services

### Security
- Added "Verify SSL certificate" checkbox option for secure connections

## [0.0.1] - 2025-10-31

### Added
- Initial release of TronbytAssistant integration
- Support for Tronbyt device notifications from Home Assistant
- Brightness control via light entity
- Update interval configuration via number entity
- Pinned app selection via select entity
- Night mode toggle via switch entity
- Night mode start/end time configuration
- Night mode brightness and app selection
- Dim mode start time and brightness configuration
- Built-in notification service (Push)
- Custom text notification service (Text)
- App deletion service (Delete)
- Template support for dynamic content
- Argument passing to apps
- HACS integration support
- Configuration flow for easy setup
- Multi-language support (English and German translations)

### Features
- Local polling IoT class for reliable communication
- Single config entry design
- Multi-device support
- Service selectors that update automatically
- Template value support for dynamic content
- HTTP error handling and logging
- Pre-commit hooks for code quality
- Comprehensive test suite

[Unreleased]: https://github.com/tronbyt/TronbytAssistant/compare/v0.0.1...HEAD
[0.0.1]: https://github.com/tronbyt/TronbytAssistant/releases/tag/v0.0.1
72 changes: 72 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contributing Guide

## Commit Message Format

This project follows [Conventional Commits](https://www.conventionalcommits.org/) specification for automatic changelog generation.

### Format

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

### Types

- **feat**: A new feature
- **fix**: A bug fix
- **docs**: Documentation only changes
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing tests or correcting existing tests
- **build**: Changes that affect the build system or external dependencies
- **ci**: Changes to our CI configuration files and scripts
- **chore**: Other changes that don't modify src or test files
- **revert**: Reverts a previous commit

### Examples

```
feat: add brightness control for night mode
fix: resolve SSL certificate validation issue
docs: update README installation instructions
style: format code with prettier
refactor: simplify device discovery logic
test: add unit tests for config flow
chore: update dependencies
ci: add automated testing workflow
```

### Scopes (optional)

- `config`: Configuration related changes
- `ui`: User interface changes
- `api`: API related changes
- `deps`: Dependency updates

### Breaking Changes

To indicate breaking changes, add `BREAKING CHANGE:` in the footer or add `!` after the type:

```
feat!: change API endpoint structure

BREAKING CHANGE: The device API now returns different field names
```

## Automatic Changelog

The project uses GitHub Actions to automatically update the `CHANGELOG.md` file based on conventional commits. When you push to the `main` branch:

1. The action scans new commits since the last changelog update
2. Categorizes commits by type (feat → Added, fix → Fixed, etc.)
3. Updates the `[Unreleased]` section in `CHANGELOG.md`
4. Commits the changes back to the repository

## Manual Workflow Trigger

You can also manually trigger the changelog update by going to the Actions tab and running the "Update Changelog" workflow.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,14 @@ This example has a varible "who", which can be used as the **key=value** pair **

# Troubleshooting
The action should do a few checks when you run it and give feedback on what went wrong. If you need deeper details, check the logs on your Tronbyt server as well as Home Assistant's logs for HTTP errors.

# Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
- Conventional commit format for automatic changelog generation
- Development setup
- Pull request process

## Changelog

This project maintains a changelog in [CHANGELOG.md](CHANGELOG.md) that is automatically updated based on conventional commits. When you create commits following the conventional format, they will automatically appear in the changelog when pushed to the main branch.