Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add CI to only use markdown extension for integrations #39283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2025
Merged

Add CI to only use markdown extension for integrations #39283

merged 3 commits into from
May 28, 2025

Conversation

silamon
Copy link
Contributor

@silamon silamon commented May 28, 2025

Proposed change

To detect cases like #39282

Type of change

  • Spelling, grammar or other readability improvements (current branch).
  • Adjusted missing or incorrect information in the current documentation (current branch).
  • Added documentation for a new integration I'm adding to Home Assistant (next branch).
  • Added documentation for a new feature I'm adding to Home Assistant (next branch).
  • Removed stale or deprecated documentation.

Additional information

  • Link to parent pull request in the codebase:
  • Link to parent pull request in the Brands repository:
  • This PR fixes or closes issue: fixes #

Checklist

  • This PR uses the correct branch, based on one of the following:
    • I made a change to the existing documentation and used the current branch.
    • I made a change that is related to an upcoming version of Home Assistant and used the next branch.
  • The documentation follows the Home Assistant documentation standards.

Summary by CodeRabbit

  • Chores
    • Updated automated workflow to detect and warn about .md files in a specific directory, prompting renaming to .markdown and failing the job if found.

@home-assistant home-assistant bot added current This PR goes into the current branch in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels May 28, 2025
@home-assistant
Copy link

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

Copy link

netlify bot commented May 28, 2025

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit ef2c574
🔍 Latest deploy log https://app.netlify.com/projects/home-assistant-docs/deploys/6836d1e35ed9f40008de21b7
😎 Deploy Preview https://deploy-preview-39283--home-assistant-docs.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.

Copy link
Contributor

coderabbitai bot commented May 28, 2025

Warning

Rate limit exceeded

@home-assistant[bot] has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 74e687e and ef2c574.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
📝 Walkthrough

Walkthrough

A new step was added to the GitHub Actions workflow within the "markdown-lint" job. This step checks for .md files in the source/_integrations directory, prints their paths if found, issues a warning to rename them to .markdown, and fails the workflow if such files exist.

Changes

File(s) Change Summary
.github/workflows/test.yml Added a workflow step to detect .md files in source/_integrations, warn, and block the workflow

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Workflow Runner

    GitHub Actions->>Workflow Runner: Start "markdown-lint" job
    Workflow Runner->>Workflow Runner: Check for .md files in source/_integrations
    alt .md files found
        Workflow Runner->>Workflow Runner: Print file paths and warning
        Workflow Runner->>GitHub Actions: Fail job
    else No .md files found
        Workflow Runner->>GitHub Actions: Continue workflow
    end
Loading

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/test.yml (1)

49-49: Add newline at end of file

YAMLlint flagged “no new line character at the end of file”. Please add a trailing newline to satisfy the linter.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 49-49: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 600c511 and 74e687e.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/test.yml

[error] 49-49: no new line character at the end of file

(new-line-at-end-of-file)

Comment on lines +17 to +26
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
MD_FILES=$(find source/_integrations -type f -name "*.md")
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Handle missing source/_integrations directory to avoid false failures

If the source/_integrations folder doesn’t exist, the find command will error out and cause the step to fail even when there are no .md files. Guard against a missing directory or redirect find’s stderr so the workflow only fails when unwanted .md files are truly present.

Proposed diff:

-  MD_FILES=$(find source/_integrations -type f -name "*.md")
+  if [ -d "source/_integrations" ]; then
+    MD_FILES=$(find source/_integrations -type f -name "*.md" 2>/dev/null)
+  else
+    MD_FILES=""
+  fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
MD_FILES=$(find source/_integrations -type f -name "*.md")
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
if [ -d "source/_integrations" ]; then
MD_FILES=$(find source/_integrations -type f -name "*.md" 2>/dev/null)
else
MD_FILES=""
fi
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
🤖 Prompt for AI Agents
In .github/workflows/test.yml around lines 17 to 26, the script fails if the
source/_integrations directory is missing because the find command errors out.
Modify the script to first check if the directory exists before running find, or
redirect find's stderr to /dev/null to suppress errors. This ensures the step
only fails when .md files are actually found, preventing false failures due to a
missing directory.

Copy link
Contributor

coderabbitai bot commented May 28, 2025

📝 Walkthrough

Walkthrough

A new step was added to the GitHub Actions workflow in the "markdown-lint" job. This step checks for .md files within the source/_integrations directory, outputs their paths and a warning if found, and fails the workflow if such files exist. No other changes were made.

Changes

File(s) Change Summary
.github/workflows/test.yml Added a workflow step to detect .md files in source/_integrations, warn, and fail the job.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Workflow Step

    GitHub Actions->>Workflow Step: Run markdown-lint job
    Workflow Step->>Workflow Step: Check for .md files in source/_integrations
    alt .md files found
        Workflow Step->>GitHub Actions: Output file paths and warning
        Workflow Step->>GitHub Actions: Fail job (exit 1)
    else No .md files found
        Workflow Step->>GitHub Actions: Continue workflow
    end
Loading

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/test.yml (2)

17-26: Fail fast to save CI resources by reordering this step
Since this check does not depend on Node.js or npm, consider moving it immediately after the checkout step (before actions/setup-node) so the workflow errors out early if invalid extensions are detected, avoiding unnecessary setup time.


49-49: Add missing newline at end of file
YAMLlint flagged a missing trailing newline. Please ensure there’s an empty line at the end for POSIX compatibility.

-        run: npm run textlint
+        run: npm run textlint
+
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 49-49: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 600c511 and 74e687e.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/test.yml

[error] 49-49: no new line character at the end of file

(new-line-at-end-of-file)

Comment on lines +17 to +26
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
MD_FILES=$(find source/_integrations -type f -name "*.md")
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard against missing source/_integrations directory to prevent CI failures
If the source/_integrations directory doesn’t exist yet, find will error out under set -e and abort the job prematurely. Wrap the lookup in a directory check or suppress find errors so CI only fails when .md files are present—not when the path is absent.

       - name: Check for .md files and suggest renaming
         run: |
-          echo "Checking for .md files in source/_integrations..."
-          MD_FILES=$(find source/_integrations -type f -name "*.md")
+          echo "Checking for .md files in source/_integrations..."
+          if [ -d source/_integrations ]; then
+            MD_FILES=$(find source/_integrations -type f -name "*.md" 2>/dev/null)
+          else
+            MD_FILES=""
+          fi
           if [ -n "$MD_FILES" ]; then
             echo "Found the following .md files:"
             echo "$MD_FILES"

Alternatively, to quickly suppress errors:

-          MD_FILES=$(find source/_integrations -type f -name "*.md")
+          MD_FILES=$(find source/_integrations -type f -name "*.md" 2>/dev/null || true)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
MD_FILES=$(find source/_integrations -type f -name "*.md")
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
- name: Check for .md files and suggest renaming
run: |
echo "Checking for .md files in source/_integrations..."
if [ -d source/_integrations ]; then
MD_FILES=$(find source/_integrations -type f -name "*.md" 2>/dev/null)
else
MD_FILES=""
fi
if [ -n "$MD_FILES" ]; then
echo "Found the following .md files:"
echo "$MD_FILES"
echo "⚠️ Please rename these files from .md to .markdown"
exit 1
fi
🤖 Prompt for AI Agents
In .github/workflows/test.yml around lines 17 to 26, the script uses `find` on
the source/_integrations directory without checking if it exists, causing CI
failures if the directory is missing. Modify the script to first check if the
source/_integrations directory exists before running `find`, or suppress errors
from `find` so the job only fails when .md files are found, not when the
directory is absent.

@silamon silamon merged commit d77d60b into current May 28, 2025
8 checks passed
@silamon silamon deleted the md-ci branch May 28, 2025 09:11
@home-assistant home-assistant bot added in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch and removed in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch labels May 28, 2025
@home-assistant
Copy link

It seems that this PR is targeted against an incorrect branch since it has a parent PR on one of our codebases. Documentation that needs to be updated for an upcoming release should target the next branch. Please change the target branch of this PR to next and rebase if needed.

@github-actions github-actions bot locked and limited conversation to collaborators May 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
current This PR goes into the current branch in-progress This PR/Issue is currently being worked on needs-rebase The PR has been branched of the wrong base branch or targets an incorrect target branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants