-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
base: current
Are you sure you want to change the base?
Conversation
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.
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughA 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
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
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 omitid
,alias
, anddescription
. 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 pluraltriggers:
key (nottrigger:
) 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
- Rename
action:
toactions:
for consistency.- 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
📒 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
```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 }}" | ||
``` |
There was a problem hiding this comment.
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.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.