Skip to content

KTibow/ha-blueprint

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

ha-blueprint

Warning

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!        ha-blueprint is being retired, it has way too many issues with it        !
! please manually use hassfest and hacs in actions, ping @KTibow if you want help !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This is a GitHub Action for advanced Home Assistant CI. Whenever you push to your repo, this will happen:

  • It'll format it (black + isort for python, prettier for js)
    • It'll go ahead and pull it, format it, and amend the changes to the last commit.
  • It'll lint it
    • JS: Run ESLint to catch syntax errors
    • Python: It runs Hassfest (to catch invalid integrations), HACS (to catch invalid HACS integrations), and flake8 (to catch invalid python).

Thanks [https://github.com/custom-components/blueprint] for the blueprint. Add this file to .github/workflows/combined.yaml:

name: "Validation And Formatting"
on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * *'
jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        name: Download repo
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v2
        name: Setup Python
        with:
          python-version: '3.8.x'
      - uses: actions/cache@v2
        name: Cache
        with:
          path: |
            ~/.cache/pip
          key: custom-component-ci
      - uses: hacs/action@main
        with:
          CATEGORY: integration
      - uses: KTibow/ha-blueprint@stable
        name: CI
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Some notes:

  • Change the CATEGORY to plugin if it's a JS card or plugin instead of an integration.
  • Remove this block to disable HACS validation:
      - uses: hacs/action@main
        with:
          CATEGORY: integration
  • Change
      - uses: KTibow/ha-blueprint@stable
        name: CI
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

to

      - uses: KTibow/ha-blueprint@stable
        name: CI
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORMAT_CODE: DISABLED

to disable code formatting.

  • Set HASSFEST to DISABLED to disable hassfest
  • Set FLAKE8_FAILS to customize stuff that the run fails on

Here's an example log run: https://github.com/KTibow/ha-blueprint/runs/1244330084?check_suite_focus=true

you don't need to click and expand this

need a badge? no worries.
https://img.shields.io/github/workflow/status/KTibow/ha-blueprint/Validation%20And%20Formatting?logoColor=white&label=way%20too%20much%20validation&logo=github-actions&style=flat-square&logoWidth=25&labelColor=black

change KTibow/ha-blueprint/Validation%20And%20Formatting to the name of your repo and workflow.

link back in markdown if you want.

give me a thanks here

give me a heart here

or just give me a star

i'm going to assume you've done that and thank you for letting me know that this is a worthwile thing.