Skip to content

DNM: Test component index ordering check workflow#6305

Closed
jesserockz wants to merge 2 commits intocurrentfrom
test-component-index-check
Closed

DNM: Test component index ordering check workflow#6305
jesserockz wants to merge 2 commits intocurrentfrom
test-component-index-check

Conversation

@jesserockz
Copy link
Member

Description

Do not merge — this PR intentionally moves WireGuard out of alphabetical order in the Network Protocols table to test the check-component-index workflow from #6304.

Expecting the workflow to post a REQUEST_CHANGES review with an inline suggestion showing the correct order.

Related issue (if applicable): N/A

Pull request in esphome with YAML changes (if applicable):

  • N/A

Checklist

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.

  • Link added in /src/content/docs/components/index.mdx when creating new documents for new components or cookbook.

Copilot AI review requested due to automatic review settings March 18, 2026 23:59
@esphome esphome bot added the current label Mar 18, 2026
@netlify
Copy link

netlify bot commented Mar 19, 2026

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit 1b1c69b
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/69bb3c4cb818b70008c2e8b1
😎 Deploy Preview https://deploy-preview-6305--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jesserockz
Copy link
Member Author

Closing — the workflow uses pull_request_target so it won't run until #6304 is merged into current.

@jesserockz jesserockz closed this Mar 19, 2026
Copy link
Contributor

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 adds an automated check for ImgTable ordering in components/index.mdx (via a Node script + GitHub Actions workflow) and intentionally introduces a misordering in the Network Protocols table to exercise the workflow behavior.

Changes:

  • Intentionally moves WireGuard out of alphabetical order in the Network Protocols ImgTable to trigger a CI review.
  • Adds script/check_component_index.mjs to detect/fix ordering and emit JSON suggestions for CI.
  • Adds .github/workflows/check-component-index.yml to run the script on PRs and post a REQUEST_CHANGES review with inline suggestions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/content/docs/components/index.mdx Reorders multiple ImgTable blocks; intentionally breaks ordering in Network Protocols to test the checker.
script/check_component_index.mjs Implements the ordering rule enforcement and suggestion generation for CI.
.github/workflows/check-component-index.yml Runs the checker on PRs touching the index and posts/dismisses reviews accordingly.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 101 to 112
<ImgTable items={[
["Network Core", "/components/network/", "server-network.svg", "dark-invert"],
["Native API", "/components/api/", "server-network.svg", "dark-invert"],
["MQTT", "/components/mqtt/", "mqtt.png"],
["WireGuard", "/components/wireguard/", "wireguard_custom_logo.svg", "dark-invert"],
["ESP-NOW", "/components/espnow/", "esp-now.svg"],
["HTTP Request", "/components/http_request/", "connection.svg", "dark-invert"],
["mDNS", "/components/mdns/", "radio-tower.svg", "dark-invert"],
["WireGuard", "/components/wireguard/", "wireguard_custom_logo.svg", "dark-invert"],
["MQTT", "/components/mqtt/", "mqtt.png"],
["Native API", "/components/api/", "server-network.svg", "dark-invert"],
["Packet Transport", "/components/packet_transport/", "packet_transport.svg", "dark-invert"],
["StatsD", "/components/statsd/", "connection.svg", "dark-invert"],
["UDP", "/components/udp/", "udp.svg"],
["Packet Transport", "/components/packet_transport/", "packet_transport.svg", "dark-invert"],
["Zigbee End Device", "/components/zigbee/", "zigbee.svg"],
Comment on lines +3 to +7
on:
pull_request_target:
types: [opened, reopened, synchronize]
paths:
- 'src/content/docs/components/index.mdx'
Comment on lines +26 to +30
- name: Checkout PR head
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.event.pull_request.head.sha }}

Comment on lines +118 to +122
await github.rest.pulls.createReview({
owner,
repo,
pull_number: pr_number,
commit_id: process.env.HEAD_SHA,
Comment on lines +128 to +130
const sorted = [...restLines].sort((a, b) =>
getName(a).toLowerCase().localeCompare(getName(b).toLowerCase()),
);
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

This PR introduces automated validation of component index ordering via a new GitHub Actions workflow and Node.js script. The workflow runs on changes to the component index file, executes a sorting verification script, and posts review suggestions for any unsorted entries. The actual component index documentation is also updated with reordered and new entries.

Changes

Cohort / File(s) Summary
CI Workflow
.github/workflows/check-component-index.yml
Introduces GitHub Actions workflow that triggers on component index changes, runs sorting validation script, and posts inline review suggestions for unsorted blocks or dismisses prior reviews if correct.
Sorting Script
script/check_component_index.mjs
New Node.js script that validates and optionally fixes alphabetical ordering of ImgTable blocks in the component index, enforcing a pinned order (Core item, Template items, then alphabetically sorted remainder) within "Network Protocols" sections. Supports check, --fix, and --suggestions modes.
Documentation Content
src/content/docs/components/index.mdx
Reorders, adds, and removes component entries across multiple ImgTable sections including Network Protocols, Display, Binary Sensor, and related subsections.

Sequence Diagram

sequenceDiagram
    actor PR as Pull Request Event
    participant GHA as GitHub Actions
    participant Script as check_component_index.mjs
    participant FS as File System
    participant API as GitHub API

    PR->>GHA: Trigger on component index changes
    GHA->>GHA: Checkout code
    GHA->>GHA: Setup Node.js
    GHA->>Script: Execute with --suggestions flag
    Script->>FS: Read component index file
    Script->>Script: Parse ImgTable blocks & validate ordering
    Script->>Script: Generate suggestions if unsorted
    Script->>FS: Write suggestions.json
    Script-->>GHA: Exit with code (0=sorted, 1=unsorted)
    
    alt Sorted
        GHA->>API: Dismiss prior bot review
        API-->>GHA: Success
    else Unsorted
        GHA->>GHA: Parse suggestions.json
        GHA->>API: Post CHANGES_REQUESTED review
        API->>API: Add inline suggestions per block
        API-->>GHA: Review posted
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

current

Suggested reviewers

  • balloob
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'DNM: Test component index ordering check workflow' is directly related to the main purpose of the changeset, which introduces a GitHub Actions workflow to check component index ordering and intentionally includes a test case.
Description check ✅ Passed The description clearly explains the PR's intent: testing the check-component-index workflow by intentionally moving WireGuard out of order and expecting a REQUEST_CHANGES review with inline suggestions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-component-index-check
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants