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

Skip to content

Docs: Add automation example for new pull requests #39470

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

Draft
wants to merge 1 commit into
base: current
Choose a base branch
from

Conversation

Animizio
Copy link

@Animizio Animizio commented Jun 10, 2025

Proposed change

This pull request adds a new automation example to the documentation for the GitHub integration. The new example demonstrates how to create a notification when a new pull request is created in a monitored repository. It follows the existing formatting style for documentation examples.

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

•	This PR modifies the documentation page: `source/_integrations/github.markdown`
•	The code follows the existing style and format.
•	All links and entity references have been checked.

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.

Proposed change
This pull request adds a new automation example to the documentation for the GitHub integration. The new example demonstrates how to create a notification when a new pull request is created in a monitored repository. It follows the existing formatting style for documentation examples.

Reason for change
The current documentation provides an example for new releases but lacks one for new pull requests. This addition will help users who want to track development activity or contributions on specific repositories directly from Home Assistant.

Additional information
	•	This PR modifies the documentation page: `source/_integrations/github.markdown`
	•	The code follows the existing style and format.
	•	All links and entity references have been checked.
@Animizio Animizio requested a review from ludeeus as a code owner June 10, 2025 20:27
@home-assistant home-assistant bot added the current This PR goes into the current branch label Jun 10, 2025
Copy link

netlify bot commented Jun 10, 2025

Deploy Preview for home-assistant-docs ready!

Name Link
🔨 Latest commit 5a43b53
🔍 Latest deploy log https://app.netlify.com/projects/home-assistant-docs/deploys/68489529ce68530008f2417e
😎 Deploy Preview https://deploy-preview-39470--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 Jun 10, 2025

📝 Walkthrough

Walkthrough

A new example titled "Notify on new Pull Request" was added to the GitHub integration documentation. This example explains how to set up an automation that sends a notification when a new pull request is detected in a monitored repository, including relevant pull request details and a direct link.

Changes

File(s) Change Summary
source/_integrations/github.markdown Added a new automation example for notifying on new pull requests, including YAML configuration and explanation.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Integration
    participant Home Assistant Automation
    participant Notify Service

    GitHub Integration->>Home Assistant Automation: Detects new pull request (sensor state changes)
    Home Assistant Automation->>Notify Service: Sends notification with PR details and link
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: 0

🧹 Nitpick comments (4)
source/_integrations/github.markdown (4)

146-149: Inconsistent heading style and plurality
The new example uses “Pull Request” (title case, singular), while existing examples use lowercase and plural (e.g., “Notify new releases”). For consistency, consider:

### Notify new pull requests

This automation sends a notification each time new pull requests are created in a monitored repository.

153-155: Example metadata consistency
Previous automation snippets omit id, alias, and description. For a cohesive docs style, either add those fields to the “Notify new releases” example as well or remove them here.


156-159: Align trigger keys and placeholder style
Use the plural triggers: key (not trigger:) to match other examples, and switch the uppercase placeholder to lowercase. Example:

-trigger:
-  - platform: state
-    entity_id: sensor.YOUR_REPO_latest_pull_request
+triggers:
+  - platform: state
+    entity_id: sensor.your_repository_latest_pull_request

160-167: Align action keys and clean up quotes

  1. Rename action: to actions: for consistency.
  2. Remove unnecessary single quotes in the message block so notifications aren’t wrapped in literal quotes.
-action:
-  - service: notify.YOUR_NOTIFY_SERVICE
+actions:
+  - service: notify.YOUR_NOTIFY_SERVICE
       data:
         title: "New PR in {{ trigger.to_state.attributes.repository }}"
-        message: |
-          '{{ trigger.to_state.state }}' (#{{ trigger.to_state.attributes.number }})
-          was opened by {{ trigger.to_state.attributes.user }}.
+        message: |
+          {{ trigger.to_state.state }} (#{{ trigger.to_state.attributes.number }})
+          was opened by {{ trigger.to_state.attributes.user }}.
         data:
           url: "{{ trigger.to_state.attributes.url }}"
📜 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 fa6cd28 and 5a43b53.

📒 Files selected for processing (1)
  • source/_integrations/github.markdown (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Redirect rules - home-assistant-docs
  • GitHub Check: Header rules - home-assistant-docs
  • GitHub Check: Pages changed - home-assistant-docs
  • GitHub Check: Lint Markdown

Comment on lines +152 to +168
```yaml
- id: 'notify_on_new_github_pull_request'
alias: "Notify on new GitHub Pull Request"
description: "Sends a notification when a new pull request is opened in a monitored GitHub repository."
trigger:
- platform: state
entity_id: sensor.YOUR_REPO_latest_pull_request
action:
- service: notify.YOUR_NOTIFY_SERVICE
data:
title: "New PR in {{ trigger.to_state.attributes.repository }}"
message: |
'{{ trigger.to_state.state }}' (#{{ trigger.to_state.attributes.number }})
was opened by {{ trigger.to_state.attributes.user }}.
data:
url: "{{ trigger.to_state.attributes.url }}"
```
Copy link
Member

Choose a reason for hiding this comment

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

This does not follow the style of the two other examples in this file.
Please adjust this example so it is as similar as possible.

@home-assistant home-assistant bot marked this pull request as draft June 11, 2025 04:56
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
current This PR goes into the current branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants