Closes #813 - Using Webhooks in GitHub
This commit is contained in:
parent
b17be0e2f1
commit
1ab25bc816
|
@ -0,0 +1,89 @@
|
|||
#-------------------------------------------
|
||||
# @CCOSTAN
|
||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||
# Read more about the house at https://vCloudInfo.com
|
||||
# https://github.com/CCOSTAN/Home-AssistantConfig/issues/813
|
||||
#-------------------------------------------
|
||||
|
||||
#-------------------------------------------
|
||||
sensor:
|
||||
- platform: travisci
|
||||
api_key: !secret travisci_api
|
||||
scan_interval: 2400
|
||||
monitored_conditions:
|
||||
- state
|
||||
#-------------------------------------------
|
||||
|
||||
#automation:
|
||||
#Tweets pushed out to twitter.
|
||||
|
||||
automation:
|
||||
- alias: "Travis FAILURE Notification"
|
||||
id: 326881a7-47ab-4897-a0c7-74ce290224de
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- sensor.ccostan_home_assistantconfig_state
|
||||
to: 'failed'
|
||||
for:
|
||||
hours: 2
|
||||
|
||||
action:
|
||||
- service: script.notify_engine
|
||||
data:
|
||||
value1: 'Travis validation testing failed.'
|
||||
who: 'carlo'
|
||||
apns: 'information'
|
||||
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Travis-CI FAILURE"
|
||||
message: "Travis validation testing failed."
|
||||
notification_id: "travis_failed"
|
||||
|
||||
- alias: 'Closed Github Issue'
|
||||
id: cccd9bef-17d9-48ae-87e3-6cf883712779
|
||||
mode: queued
|
||||
trigger:
|
||||
platform: webhook
|
||||
webhook_id: !secret github_webhook
|
||||
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{%- if trigger.json.action == "created" or "closed" or "opened" or "reopened" or trigger.json.ref %}
|
||||
True
|
||||
{%- else -%}
|
||||
False
|
||||
{%- endif -%}
|
||||
|
||||
action:
|
||||
- service: script.tweet_engine_image
|
||||
data:
|
||||
tweet: >-
|
||||
New Code Alert!
|
||||
{%- if trigger.json.pull_request -%}
|
||||
{{ trigger.json.pull_request.title }} - Pull Request #{{ trigger.json.pull_request.number}} {{
|
||||
trigger.json.action}} by {{trigger.json.sender.login}}
|
||||
{{trigger.json.pull_request.html_url}}
|
||||
{%- elif trigger.json.issue -%}
|
||||
{{ trigger.json.issue.title }} - Issue #{{ trigger.json.issue.number}} {{
|
||||
trigger.json.action }} by {{trigger.json.sender.login}}
|
||||
{{trigger.json.issue.html_url}}
|
||||
{%- endif %}
|
||||
{% set hashtags = [
|
||||
" #Github",
|
||||
" #SmartHomeCode"
|
||||
] %}
|
||||
{{ phrases|random ~ " " ~ hashtags|random }}
|
||||
image: >-
|
||||
{% set pictures = [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad3.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/bearstoneflow.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad4.png"
|
||||
] %}
|
||||
{{ pictures|random }}
|
|
@ -1,43 +0,0 @@
|
|||
#-------------------------------------------
|
||||
# @CCOSTAN
|
||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||
# Read more about the house at https://vCloudInfo.com
|
||||
#-------------------------------------------
|
||||
|
||||
#-------------------------------------------
|
||||
sensor:
|
||||
- platform: travisci
|
||||
api_key: !secret travisci_api
|
||||
scan_interval: 2400
|
||||
monitored_conditions:
|
||||
- state
|
||||
#-------------------------------------------
|
||||
|
||||
#automation:
|
||||
#Tweets pushed out to twitter.
|
||||
|
||||
automation:
|
||||
- alias: "Travis FAILURE Notification"
|
||||
id: 326881a7-47ab-4897-a0c7-74ce290224de
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id:
|
||||
- sensor.ccostan_home_assistantconfig_state
|
||||
to: 'failed'
|
||||
for:
|
||||
hours: 2
|
||||
|
||||
action:
|
||||
- service: script.notify_engine
|
||||
data:
|
||||
value1: 'Travis validation testing failed.'
|
||||
who: 'carlo'
|
||||
apns: 'information'
|
||||
|
||||
- service: persistent_notification.create
|
||||
data:
|
||||
title: "Travis-CI FAILURE"
|
||||
message: "Travis validation testing failed."
|
||||
notification_id: "travis_failed"
|
|
@ -196,40 +196,6 @@ automation:
|
|||
media_content_id: "https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/sounds/twitter-chirp.mp3"
|
||||
media_content_type: audio/mp4
|
||||
|
||||
- alias: 'Closed Github Issue'
|
||||
id: cccd9bef-17d9-48ae-87e3-6cf883712779
|
||||
trigger:
|
||||
platform: event
|
||||
#Sent from IFTTT Webhooks : {"action":"closed_github", "repo":" {{RepositoryName}}", "issue":" {{IssueTitle}}","issueurl":" {{IssueURL}}"}
|
||||
event_type: ifttt_webhook_received
|
||||
event_data:
|
||||
action: closed_github
|
||||
|
||||
action:
|
||||
- service: script.tweet_engine_image
|
||||
data:
|
||||
tweet: >-
|
||||
{% set repo = trigger.event.data.repo %}
|
||||
{% set issue = trigger.event.data.issue %}
|
||||
{% set issueurl = trigger.event.data.issueurl %}
|
||||
{% set phrases = [
|
||||
"New Code: " ~ issue ~ " " ~ issueurl
|
||||
] %}
|
||||
{% set hashtags = [
|
||||
"#Github",
|
||||
"#SmartHomeCode"
|
||||
] %}
|
||||
{{ phrases|random ~ " " ~ hashtags|random }}
|
||||
image: >-
|
||||
{% set pictures = [
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad2.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad3.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/bearstoneflow.png",
|
||||
"/config/www/custom_ui/floorplan/images/branding/repo_ad4.png"
|
||||
] %}
|
||||
{{ pictures|random }}
|
||||
|
||||
- alias: 'Random House stats'
|
||||
id: b274a40d-cb67-4d6a-94d1-5fa685ae5ea4
|
||||
mode: single
|
||||
|
|
|
@ -39,6 +39,7 @@ small_garage_id: 00000000000000000000001
|
|||
garadget_username: user@email.com
|
||||
garadget_password: password
|
||||
garadget_access_token: ThisIsAVERYSECUREANDUNiqueAccessToken
|
||||
github_webhook: https://www.home-assistant.io/docs/automation/trigger/#webhook-trigger
|
||||
google_cal_clientid: clientidsecretsecretsecret.apps.googleusercontent.com
|
||||
google_cal_clientsecret: more-secretstuff
|
||||
sleepiq_username: user@email.com
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 35 KiB |
Loading…
Reference in New Issue