home-assistant-autopilot

中文文档
2.0.0发布于 2026/11/04MITTypeScriptES Module构建来源已验证

Validates Home Assistant integrations, cards, themes and templates for the Marketplace, and attaches each release asset.

原始使用文档
文档目录7 节
  1. Usage
  2. Validate
  3. Publish
  4. What it checks
  5. What it publishes
  6. Outside GitHub Actions
  7. Support

Home Assistant Autopilot

Marketplace Release npm Sponsor

Validates integrations, dashboard cards, themes and templates for the Home Assistant Marketplace, and attaches what the Marketplace installs to each release.

It reads what the repository is from the repository itself: hacs.json, the integration under custom_components/, the dashboard module, the theme or the template. Nothing needs to be configured.

Usage

The action is listed on the GitHub Marketplace.

Validate

Add a job to CI that checks out the repository and runs the action:

name: CI

on:
  push:
    branches: [main]
  pull_request:

permissions: {}

jobs:
  validate:
    name: Home Assistant Marketplace
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v7
        with:
          persist-credentials: false
      - uses: roquerodrigo/home-assistant-autopilot@v2

The job summary lists every check, and each problem is annotated on the file it belongs to.

Publish

After the release is published, attach its asset. With Release Autopilot it is one more step in the same job, with no checkout:

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - id: release
        uses: roquerodrigo/release-autopilot@v1
        with:
          token: ${{ secrets.RELEASE_TOKEN }}
          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

      - if: steps.release.outputs.released == 'true'
        uses: roquerodrigo/home-assistant-autopilot@v2
        with:
          command: publish
          tag: ${{ steps.release.outputs.tag }}

Any release tool works the same way: pass the tag of a published release.

@v2 follows every 2.x release, and a breaking change only arrives with a new major version. @latest follows every release, breaking ones included. To stay on one version, use the tag of a release, such as @v2.0.0, or its commit.

InputMeaning
commandvalidate, the default, or publish
tagFor publish, the tag of the published release
tokenDefaults to GITHUB_TOKEN. publish needs contents write access
repositoryDefaults to the repository of the workflow
OutputMeaning
categoryintegration, dashboard, theme or template
domainThe domain of the integration, if it is one
assetThe name of the asset publish attached, if any
asset-urlIts download URL, if any

What it checks

CheckWhat fails it
LayoutNo hacs.json, more than one integration or theme, a module or template hacs.json names that is missing, a domain in the wrong format or out of its directory, a manifest without a version
hacs.jsonNo name, zip_release on anything but an integration, or without a filename ending in .zip
Versionsmanifest.json, pyproject.toml and package.json declaring different versions
Download sizeOver 100 MiB or 50,000 files, or a template over 5 MiB
HassfestAnything the Home Assistant manifest validator reports, for an integration
CatalogAnything the catalog checks of the Marketplace report: brands, topics, description, archived and the rest

Keys of hacs.json the Marketplace no longer reads, such as hacs, are reported as warnings. A private repository cannot enter the Marketplace, so the catalog checks are skipped there, and the summary says so.

Hassfest and the catalog checks run in Docker images pinned by digest, which this repository keeps up to date. They are linux/amd64 images, so the job needs a Linux runner such as ubuntu-latest.

The checks themselves are described in the Marketplace reference.

What it publishes

The Marketplace installs a published release, and for an integration it refuses one whose manifest declares another version. publish therefore fails when a version declared at the tag differs from the tag, before anything is attached.

RepositoryAsset
IntegrationWith zip_release in hacs.json, a zip named after filename holding custom_components/<domain>/ at its root
DashboardThe module, as it is at the tag
Theme, templateNothing: the Marketplace installs them from the repository

The zip holds the files tracked at the tag, read through the GitHub API, in a fixed order and with fixed timestamps, so the same tag always gives the same bytes. An asset of the same name is replaced, so a run can be repeated.

The release's download_count becomes the install counter: without the asset, the Marketplace downloads through the API and the download is counted nowhere.

{ "name": "My integration", "zip_release": true, "filename": "my_integration.zip" }

Outside GitHub Actions

The same checks run from any terminal with the npm package, on Node 24 or later, with Docker for hassfest and the catalog checks:

GITHUB_TOKEN=... npx home-assistant-autopilot validate --repository owner/name
GITHUB_TOKEN=... npx home-assistant-autopilot publish --repository owner/name --tag v1.2.0

validate prints the report and exits with 1 when a check fails. The catalog checks read the repository on GitHub at --ref, the commit checked out by default, so push it first. publish prints the outcome as JSON:

{"asset":"my_integration.zip","assetUrl":"https://github.com/owner/name/releases/download/v1.2.0/my_integration.zip","category":"integration","domain":"my_integration"}
OptionMeaning
--repository <owner/name>The repository on GitHub. Defaults to GITHUB_REPOSITORY
--directory <path>validate: the checkout. Defaults to the current directory
--ref <commit>validate: the commit the catalog checks read
--tag <tag>publish: the tag of the release

The token comes from GITHUB_TOKEN, or GH_TOKEN. The package also exports both commands as a library:

import { HomeAssistantAutopilot } from 'home-assistant-autopilot'

const autopilot = new HomeAssistantAutopilot({ repository: 'owner/name', token: process.env.GITHUB_TOKEN! })
const { report } = await autopilot.validate()
const { asset } = await autopilot.publish('v1.2.0')

A reporter with group, info and warning receives the progress, which otherwise goes to the console.

Support

This project is built and maintained on personal time. If it is useful to you, consider sponsoring the work — it keeps the development, the testing and the releases coming.

版本与发布记录

home-assistant-autopilot 共发布 5 个版本,首次发布于 2026/11/04;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.0.0latest2026/11/041 天前
1.0.22026/11/041 天前
1.0.12026/11/041 天前
1.0.02026/11/041 天前
0.0.0-stage2026/11/041 天前

关于 home-assistant-autopilot 的常见问题

home-assistant-autopilot 是什么?

Validates Home Assistant integrations, cards, themes and templates for the Marketplace, and attaches each release asset.

如何安装 home-assistant-autopilot?

在项目目录运行 npm install home-assistant-autopilot,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 home-assistant-autopilot,可以用 npx home-assistant-autopilot 直接运行。

home-assistant-autopilot 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

home-assistant-autopilot 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

home-assistant-autopilot 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

home-assistant-autopilot 可以商用吗?

home-assistant-autopilot 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

home-assistant-autopilot 还在维护吗?

最新版本 2.0.0 发布于 2026/11/04(1 天前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/11/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。