Skip to content

Commit

Permalink
Adding GitHub checkrun sensors and MQTT save #21
Browse files Browse the repository at this point in the history
  • Loading branch information
conorsham committed Aug 5, 2021
1 parent 88cce49 commit 712ad45
Show file tree
Hide file tree
Showing 13 changed files with 185 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .HA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.7.4
2021.8.0
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,29 @@ jobs:
continue-on-error: true
with:
args: "remark --no-stdout --color --frail --use preset-lint-recommended ."
home_assistant_current:
runs-on: ubuntu-latest
needs: [yamllint, remarklint]
steps:
- name: Getting your configuration from GitHub
uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Copy stub files into configuration folder
run: |
cp -R secrets_github.yaml secrets.yaml
cp -R customize_sample.yaml customize.yaml
cp -R 0d25726f0c18_sample.json 0d25726f0c18.json
sudo mkdir -p /github/workspace/tmp
#sudo touch fullchain.pem
#sudo touch privkey.pem
HA_VERSION=$(<.HA_VERSION)
- name: Install Home Assistant
run: pip3 install homeassistant==$(cat .HA_VERSION)
- name: Check config
run: hass -c . --script check_config --info all
home_assistant_stable:
runs-on: ubuntu-latest
needs: [yamllint, remarklint]
Expand Down
30 changes: 30 additions & 0 deletions automations/system/github_actions_webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#####
#
#
#####

alias: github actions webhook
id: 'b70b316f-bf5a-4618-95c3-8594cd290b3a'

mode: queued

trigger:
platform: webhook
webhook_id: !secret github_actions_webhook

condition: '{{trigger.json.check_run.check_suite.head_branch == "master"}}'

action:
- service: mqtt.publish
data:
topic: 'github_checkrun/{{ trigger.json.check_run.name}}'
payload: >
{"status": {%- if trigger.json.check_run.status == 'completed' -%}
"{{trigger.json.check_run.conclusion}}"
{%- else -%}
"{{trigger.json.check_run.status}}"
{%- endif -%}, "id": "{{trigger.json.check_run.id
}}", "started_at": "{{trigger.json.check_run.started_at
}}", "completed_at": "{{trigger.json.check_run.completed_at
}}", "details_url": "{{trigger.json.check_run.details_url}}"}
retain: true
2 changes: 1 addition & 1 deletion entities/rest_command/github_actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#####

github_actions:
url: https://api.github.com/BeardedTinker/Home-Assistant_Config/actions/workflows/main.yml/dispatches
url: https://api.github.com/repos/BeardedTinker/Home-Assistant_Config/actions/workflows/main.yml/dispatches
method: POST
headers:
authorization: !secret github_token2
Expand Down
11 changes: 11 additions & 0 deletions entities/sensors/system/github_checkrun_home_assistant_beta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - Home Assistant beta release
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_home_assistant_beta
state_topic: github_checkrun/home_assistant_beta
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/home_assistant_beta
icon: mdi:github
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - Home Assistant curent release
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_home_assistant_current
state_topic: github_checkrun/home_assistant_current
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/home_assistant_current
icon: mdi:github
11 changes: 11 additions & 0 deletions entities/sensors/system/github_checkrun_home_assistant_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - Home Assistant dev release
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_home_assistant_dev
state_topic: github_checkrun/home_assistant_dev
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/home_assistant_dev
icon: mdi:github
11 changes: 11 additions & 0 deletions entities/sensors/system/github_checkrun_home_assistant_stable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - Home Assistant Latest release
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_home_assistant_stable
state_topic: github_checkrun/home_assistant_stable
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/home_assistant_stable
icon: mdi:github
11 changes: 11 additions & 0 deletions entities/sensors/system/github_checkrun_remarklint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - remarklint
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_remarklint
state_topic: github_checkrun/remarklint
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/remarklint
icon: mdi:github
11 changes: 11 additions & 0 deletions entities/sensors/system/github_checkrun_yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####
# Populate data from Checkrun - yamlint
# By PinkyWafer - https://github.com/pinkywafer/Home-Assistant_Config/
#####

platform: mqtt
name: github_checkrun_yamllint
state_topic: github_checkrun/yamllint
value_template: "{{ value_json.status }}"
json_attributes_topic: github_checkrun/yamllint
icon: mdi:github
Loading

0 comments on commit 712ad45

Please sign in to comment.