Hi,
Following a question by allanparsson
, i looked into how to trigger actions on your own repository (or any repository you own) after a new HA release, it turns out you can, using 2 actions.
Inspired from:
The first one will check for a new HA release and commit a new
release-versions/home-assistant-latest.txt
file if an update is found:
(don’t forget to replace your user name below)
check_ha_release.yml:
name: Get HA latest release version
on:
schedule:
- cron: '0 10 * * *'
jobs:
get-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Fetch release version
run: |
curl -sL https://api.github.com/repos/home-assistant/home-assistant/releases/latest | \
jq -r ".tag_name" > release-versions/home-assistant-latest.txt
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Commit latest release version
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'GitHub'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.REPO_SCOPED_TOKEN }}@github.com/$GITHUB_REPOSITORY
git checkout "${GITHUB_REF:11}"
git commit -am "New release version"
git push
This will in turn be used to trigger the second action which you can use to do more custom actions, like checking your config files with the following trigger:
check_config_on_release.yml:
on:
push:
paths:
- 'release-versions/*'
home_assistant_stable:
name: "Home-Assistant: Stable"
runs-on: ubuntu-latest
steps:
- name: Getting your configuration from GitHub
uses: actions/checkout@v1
- name: Copy stub files into configuration folder
run: cp -R ./.stubs/* ./config
- name: Home Assistant Version
uses: "docker://homeassistant/home-assistant:stable"
with:
args: >
python -m homeassistant --version
- name: Home Assistant Check
uses: "docker://homeassistant/home-assistant:stable"
with:
args: python -m homeassistant --config ./config/ --script check_config --info all
Cheers