Skip to content

Kampi/fix changelog check#36

Merged
Kampi merged 4 commits into
mainfrom
kampi/Fix-Changelog-Check
Feb 5, 2026
Merged

Kampi/fix changelog check#36
Kampi merged 4 commits into
mainfrom
kampi/Fix-Changelog-Check

Conversation

@Kampi
Copy link
Copy Markdown
Owner

@Kampi Kampi commented Feb 5, 2026

Summary by CodeRabbit

  • Documentation

    • Added comprehensive contributor documentation covering coding conventions, project structure, and maintenance practices.
    • Added ESP Registry badge to README.
  • Chores

    • Improved release workflow with enhanced version handling and release notes generation.
    • Simplified documentation deployment process and removed nightly release artifacts.
    • Refined changelog validation workflow.

Kampi added 4 commits January 26, 2026 17:09
- Add Copilot instructions
- Documentation updated
- Component release workflow optimized

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
Closes: Issue #29 

Signed-of-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
- Rework the release pipeline

Closes: #32

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
- Fix Check-Changelog CI/CD failure for the Unrelease section in
  CHANGELOG.md

Closes #35

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
Copilot AI review requested due to automatic review settings February 5, 2026 12:57
@Kampi Kampi added bug Something isn't working documentation Improvements or additions to documentation labels Feb 5, 2026
@Kampi Kampi merged commit b2b6de8 into main Feb 5, 2026
2 of 4 checks passed
@Kampi Kampi deleted the kampi/Fix-Changelog-Check branch February 5, 2026 12:58
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 5, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds comprehensive contributor guidelines documentation in .github/copilot-instructions.md, updates multiple GitHub workflows to refine CI/CD processes (changelog validation, documentation deployment, release versioning), removes nightly release artifact creation, and adds an ESP Registry badge to the README.

Changes

Cohort / File(s) Summary
Documentation & Metadata
.github/copilot-instructions.md, README.md
Introduces 502-line contributor guidelines documenting coding conventions, project structure, documentation standards, error handling, and testing practices; adds ESP Registry badge.
Workflow: Changelog & Code Style
.github/workflows/astyle.yaml, .github/workflows/changelog-check.yaml
Removes explicit master_branch environment variable from astyle workflow; updates changelog validation to reference root-level CHANGELOG.md instead of hardware/CHANGELOG.md, broadens PR trigger scope, and adjusts validation logic (empty sections now non-fatal, missing sections exit gracefully).
Workflow: Documentation Deployment
.github/workflows/documentation.yaml
Simplifies push deployment logic to target main/master branches only; removes nightly release tarball creation and GitHub Releases upload; renames job and reorganizes documentation steps; adds id-token permission.
Workflow: Release & Versioning
.github/workflows/release.yaml
Reworks version extraction to strip _Dev suffix; splits version into MAJOR/MINOR/BUILD components with dynamic CMakeLists injection of LIB_MAJOR, LIB_MINOR, LIB_BUILD; replaces git-auto-commit with explicit git user config and conditional commits; adds tag existence checks; replaces multi-step release flow with RELEASE_NOTES.md generation and gh release create CLI invocation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Issue #29 #30: Adds the same .github/copilot-instructions.md documentation file and modifies matching workflow files.
  • Release 0.0.2 #17: Modifies release workflow version extraction and CMakeLists version variable injection logic with similar refactoring approach.
  • Release 0.0.2 #22: Overlaps on release.yaml changes for version extraction, CMakeLists manipulation, and release publishing via GitHub CLI.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the CI/CD workflows to fix the changelog check and improve the release process. The changes update paths from hardware/CHANGELOG.md to CHANGELOG.md, add version handling improvements, and include comprehensive GitHub Copilot coding guidelines.

Changes:

  • Fixed changelog check workflow to reference correct CHANGELOG.md path and improve validation behavior
  • Enhanced release workflow with better version extraction, CMakeLists.txt updates, and GitHub CLI-based release creation
  • Simplified documentation workflow by removing nightly release builds and focusing on GitHub Pages deployment
  • Added comprehensive GitHub Copilot instructions document with project-specific coding standards

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
README.md Added ESP Registry badge for component visibility
.github/workflows/release.yaml Major refactoring: added version suffix removal, improved CMakeLists.txt updates, switched to GitHub CLI for releases
.github/workflows/documentation.yaml Simplified to remove nightly builds and focus on GitHub Pages deployment only
.github/workflows/changelog-check.yaml Updated changelog path and relaxed validation to allow empty/incomplete sections during development
.github/workflows/astyle.yaml Removed unused environment variable
.github/copilot-instructions.md New comprehensive coding guidelines document for the project

Comment thread README.md
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?logo=opensourceinitiative)](https://www.gnu.org/licenses/gpl-3.0)
[![ESP-IDF](https://img.shields.io/badge/ESP--IDF-v5.1+-blue.svg)](https://github.com/espressif/esp-idf)
[![Documentation](https://img.shields.io/badge/User%20Guide-PDF-007ec6?longCache=true&style=flat&logo=asciidoctor&colorA=555555)](https://kampi.github.io/ESP32-Lepton/)
[![ESP Registry](https://components.espressif.com/components/kampi/esp32-lepton/badge.svg)](https://components.espressif.com/components/kampi/esp32-lepton/badge.svg)
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ESP Registry badge URL is incorrect. The badge should link to the component page URL, not to the badge image URL itself. Currently, clicking the badge will display the SVG image instead of navigating to the component page. The href should be "https://components.espressif.com/components/kampi/esp32-lepton" (without the trailing "/badge.svg").

Suggested change
[![ESP Registry](https://components.espressif.com/components/kampi/esp32-lepton/badge.svg)](https://components.espressif.com/components/kampi/esp32-lepton/badge.svg)
[![ESP Registry](https://components.espressif.com/components/kampi/esp32-lepton/badge.svg)](https://components.espressif.com/components/kampi/esp32-lepton)

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +53
# Remove _Dev suffix for the release version
RELEASE_VERSION=$(echo "$VERSION" | sed 's/_Dev$//')
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The VERSION extraction logic assumes the version format in idf_component.yml is always 'version: "X.X.X_Dev"', but according to the current idf_component.yml file (version: "0.0.2"), there is no "_Dev" suffix. This means the sed command 's/_Dev$//' will have no effect on versions that don't have this suffix. Consider adding a check to verify if the "_Dev" suffix exists before attempting to remove it, or document the expected version format in idf_component.yml for development versions.

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +108
if ! grep -q "set(${REPO_NAME}_LIB_MAJOR" CMakeLists.txt; then
# Add version variables before register_component()
sed -i "/register_component()/i # Library version\nset(${REPO_NAME}_LIB_MAJOR $MAJOR)\nset(${REPO_NAME}_LIB_MINOR $MINOR)\nset(${REPO_NAME}_LIB_BUILD $BUILD)\n" CMakeLists.txt
else
# Update existing version variables
sed -i -E "s/set\(${REPO_NAME}_LIB_MAJOR [0-9]+\)/set(${REPO_NAME}_LIB_MAJOR $MAJOR)/" CMakeLists.txt
sed -i -E "s/set\(${REPO_NAME}_LIB_MINOR [0-9]+\)/set(${REPO_NAME}_LIB_MINOR $MINOR)/" CMakeLists.txt
sed -i -E "s/set\(${REPO_NAME}_LIB_BUILD [0-9]+\)/set(${REPO_NAME}_LIB_BUILD $BUILD)/" CMakeLists.txt
fi
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMakeLists.txt update logic assumes version variables don't exist and will add them before "register_component()", but looking at the current CMakeLists.txt file (lines 30-33), the version variables are referenced AFTER "register_component()" in target_compile_definitions. This means the new logic will create duplicate version variable references. The check at line 100 should verify if the version variables exist anywhere in the file, not just check if they need to be added before register_component(). Additionally, if they exist after register_component(), they should be updated in place rather than adding new ones before it.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to 145
- name: Wait for tag to be available
run: |
echo "Waiting for tag to be fully available..."
sleep 5
git fetch --tags
git tag -l "$VERSION"

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a fixed 5-second sleep to wait for tag availability is unreliable and inefficient. In most cases, the tag should be immediately available after pushing, making the wait unnecessary. In edge cases where there might be replication delays, 5 seconds might not be enough. Consider implementing a retry loop with exponential backoff, or remove this step entirely since "git fetch --tags" should handle any synchronization needed.

Suggested change
- name: Wait for tag to be available
run: |
echo "Waiting for tag to be fully available..."
sleep 5
git fetch --tags
git tag -l "$VERSION"

Copilot uses AI. Check for mistakes.
run: |
# Extract the section for the current version from CHANGELOG.md
awk -v version="$VERSION" '
/^## \['"$VERSION"'\]/ { found=1; next }
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The awk script for extracting release notes is inconsistent in how it uses the version variable. Line 149 correctly passes VERSION to awk using '-v version="$VERSION"', but line 150 uses shell variable expansion '/^## ['"$VERSION"']/' instead of using the awk variable. This mixing of approaches works but is confusing and harder to maintain. Consider using the awk variable consistently: change line 150 to '/^## [/ && $0 ~ "\[" version "\]"' to match the version using the awk variable that was already defined.

Suggested change
/^## \['"$VERSION"'\]/ { found=1; next }
/^## \[/ && $0 ~ "\\[" version "\\]" { found=1; next }

Copilot uses AI. Check for mistakes.
gh release create "$VERSION" \
--title "Release $VERSION" \
--notes-file RELEASE_NOTES.md \
--target main No newline at end of file
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub release creation specifies '--target main' (line 171) which hardcodes the target branch to 'main'. However, this workflow runs on both 'main' and 'master' branches according to the trigger (lines 5-7). If a release is created from the 'master' branch, the '--target main' will incorrectly reference the 'main' branch. Consider using '--target ${{ github.ref_name }}' to dynamically reference the branch that triggered the workflow.

Suggested change
--target main
--target ${{ github.ref_name }}

Copilot uses AI. Check for mistakes.
Comment on lines +131 to 137
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag $VERSION already exists, skipping tag creation"
else
echo "## Release $VERSION" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "See [CHANGELOG.md](CHANGELOG.md) for details." >> $GITHUB_ENV
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
echo "Tag $VERSION created and pushed"
fi
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git tag check uses "git rev-parse" which checks if a ref exists (tag, branch, or commit), but doesn't specifically verify if it's a tag. This could cause issues if a branch with the same name as the version exists. Consider using "git tag -l "$VERSION"" instead to specifically check for tag existence, which is more explicit and safer.

Copilot uses AI. Check for mistakes.
Comment on lines 62 to +66
if [ "$FOUND_SECTIONS" = false ]; then
echo "Error: No valid sections found in [Unreleased]"
echo "Warning: No valid sections found in [Unreleased], but content exists"
echo "Expected sections: Added, Changed, Fixed, Removed"
exit 1
echo "This is allowed during early development"
exit 0
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message was changed from an error to a success message, but the behavior is inconsistent with the validation intent. When the [Unreleased] section is empty (line 44), the script exits with code 0 (success) saying "allowed during development". However, when no valid sections are found but content exists (lines 63-66), it also exits with code 0 despite potentially having incorrectly formatted content. This could allow malformed changelog entries to pass validation. Consider whether this should remain a warning with exit 0, or if it should be a failure to enforce proper formatting.

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +97
# Extract repository name and convert to uppercase with underscores
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2 | tr '[:lower:]' '[:upper:]' | tr '-' '_')
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script extracts the repository name and converts it to uppercase with underscores for variable naming (line 97). However, if the repository name contains characters other than lowercase letters, numbers, and hyphens, the conversion might produce invalid or unexpected variable names. Consider adding validation or sanitization to ensure the resulting variable name is valid for CMake (only alphanumeric and underscore characters).

Suggested change
# Extract repository name and convert to uppercase with underscores
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2 | tr '[:lower:]' '[:upper:]' | tr '-' '_')
# Extract repository name, sanitize for CMake (alnum and underscore only), and convert to uppercase
REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2 | sed 's/[^A-Za-z0-9]/_/g' | tr '[:lower:]' '[:upper:]')

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +102
# Add version variables before register_component()
sed -i "/register_component()/i # Library version\nset(${REPO_NAME}_LIB_MAJOR $MAJOR)\nset(${REPO_NAME}_LIB_MINOR $MINOR)\nset(${REPO_NAME}_LIB_BUILD $BUILD)\n" CMakeLists.txt
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command to insert version variables before 'register_component()' uses '/register_component()/i' which will insert before any line containing 'register_component()'. However, looking at the CMakeLists.txt file, line 27 contains just 'register_component()' with no arguments. The insertion command should work, but the newlines in the sed command need careful handling. The command uses '\n' to insert newlines, but in the actual execution context, these may not render as expected. Consider using multiple echo statements or printf to ensure proper formatting of the inserted lines.

Suggested change
# Add version variables before register_component()
sed -i "/register_component()/i # Library version\nset(${REPO_NAME}_LIB_MAJOR $MAJOR)\nset(${REPO_NAME}_LIB_MINOR $MINOR)\nset(${REPO_NAME}_LIB_BUILD $BUILD)\n" CMakeLists.txt
# Build version block with proper newlines
VERSION_BLOCK="# Library version
set(${REPO_NAME}_LIB_MAJOR $MAJOR)
set(${REPO_NAME}_LIB_MINOR $MINOR)
set(${REPO_NAME}_LIB_BUILD $BUILD)
"
# Insert version block before the first occurrence of register_component()
tmp_file=$(mktemp)
awk -v block="$VERSION_BLOCK" '
/register_component\(\)/ && !done {
print block
done=1
}
{ print }
' CMakeLists.txt > "$tmp_file"
mv "$tmp_file" CMakeLists.txt

Copilot uses AI. Check for mistakes.
@coderabbitai coderabbitai Bot mentioned this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants