Skip to content
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

Create new GitHub label when Home Assistant upgrades #249

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion automations/system/upgrade/upgrade_available.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
alias: System - Upgrade available
alias: 'System - Upgrade available'
id: 'a3f210ad-0587-4ed2-a5cd-a912d38ad3ee'
description: 'DevOps task to create new issue in GitHub when an update is available.'
initial_state: true
Expand Down Expand Up @@ -51,12 +51,20 @@ action:
Release notes available via {{ state_attr('binary_sensor.updater','release_notes') }}.
notification_id: home_assistant_upgrade

# Create a new label in GitHub.
- service: rest_command.github_new_label
data_template:
name: "{{ states('sensor.version_latest') }}"
description: ""
color: "BCBCBC"

# Call my GiHub rest command to create a new issue in GitHub.
- service: rest_command.github_new_issue_upgrade
data_template:
current_version: "{{ states('sensor.version_current') }}"
upgrade_version: "{{ states('sensor.version_latest') }}"
release_notes: "{{ state_attr('binary_sensor.updater','release_notes') }}"
labels: ['task: upgrade','task: maintenance','{{ states("sensor.version_latest") }}']

# Related
# https://github.com/jcallaghan/home-assistant-config/issues/105
Expand Down
6 changes: 6 additions & 0 deletions entities/rest/github_new_label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github_new_label:
url: "https://api.github.com/repos/jcallaghan/home-assistant-config/labels"
method: POST
headers:
Authorization: !secret github_token
payload: '{"name":"{{ name }}","description":"{{ description }}","color":"{{ color }}"}'