Coder Social home page Coder Social logo

actions's Introduction

actions

GitHub Actions and helper for Home Assistant workflows

hassfest

Run hassfest to validate standalone integration repositories.

action: home-assistant/actions/hassfest@master

example implementation:

name: Validate with hassfest

on:
  push:
  pull_request:
  schedule:
    - cron:  '0 0 * * *'

jobs:
  validate:
    runs-on: "ubuntu-latest"
    steps:
        - uses: "actions/checkout@v4"
        - uses: "home-assistant/actions/hassfest@master"

This will run the hassfest action on every push and pull request to all branches, as well as every midnight.

Helpers

A collection of GitHub Action helpers, these are considered internal to the Home Assistant organization on GitHub and will change without warning.

actions's People

Contributors

agners avatar cdce8p avatar danieldiazi avatar davet2001 avatar dependabot[bot] avatar edenhaus avatar frenck avatar hunterjm avatar jwillemsen avatar ludeeus avatar marcolivierarsenault avatar martinhjelmare avatar mdegat01 avatar pvizeli avatar sairon avatar wrt54g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

actions's Issues

Issue with manifest key sort validation?

In #devs, someone reported that they were getting the following error when running the action:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 244, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 166, in main
    plugin.validate(integrations, config)
  File "/usr/src/homeassistant/script/hassfest/manifest.py", line 393, in validate
    subprocess.run(
  File "/usr/local/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['pre-commit', 'run', '--hook-stage', 'manual', 'prettier', '--files', PosixPath('/github/workspace/custom_components/netzooe_eservice/manifest.json')]' returned non-zero exit status 1.
Validating manifest...

It turns out their keys weren't sorted, but this error is obviously unhelpful and doesn't tell them that.

Wondering if there is an issue here with setting up pre-commit - from what I can tell, the Dockerfile installs requirements.txt but that doesn't contain pre-commit, and I think the pre-commit config would also have to be included so that prettier is installed as a pre-commit item. EDIT: It looks like this is missing pre-commit. I THINK just by installing pre-commit, that this will work?

I may attempt to PR this but someone with more knowledge of this than me would probably be able to get it done faster 🙂

Hassfest fails with "black.parsing.InvalidInput: Cannot parse: 6:27: APPLICATION_CREDENTIALS = [,]"

Hassfest fails for one of my repos with this traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 242, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 164, in main
    plugin.validate(integrations, config)
  File "/usr/src/homeassistant/script/hassfest/application_credentials.py", line 29, in validate
    config.cache["application_credentials"] = content = generate_and_validate(
  File "/usr/src/homeassistant/script/hassfest/application_credentials.py", line 21, in generate_and_validate
    return format_python_namespace({"APPLICATION_CREDENTIALS": match_list})
  File "/usr/src/homeassistant/script/hassfest/serializer.py", line 98, in format_python_namespace
    return format_python(code, generator=generator)
  File "/usr/src/homeassistant/script/hassfest/serializer.py", line 73, in format_python
    return black.format_str(content.strip(), mode=Mode())
  File "/usr/local/lib/python3.10/site-packages/black/__init__.py", line 1054, in format_str
    dst_contents = _format_str_once(src_contents, mode=mode)
  File "/usr/local/lib/python3.10/site-packages/black/__init__.py", line 1064, in _format_str_once
    src_node = lib2to3_parse(src_contents.lstrip(), mode.target_versions)
  File "/usr/local/lib/python3.10/site-packages/black/parsing.py", line 126, in lib2to3_parse
    raise exc from None
black.parsing.InvalidInput: Cannot parse: 6:27: APPLICATION_CREDENTIALS = [,]
Validating application_credentials...
Error: Process completed with exit code 1.

I'm not sure but it down't look like a problem with my repo!?

Entity translation: hassfest failing when entity state key is capitalized

The Hassfest workflow is failing when defining an entity state starting with a capital letter. For example, I have a select entity that allows selecting litter type including "Bentonite", "Tofu", and "Mixed".

Within strings.json and en.json the entity is defined in this manner:

        "litter_type": {
          "name": "Litter type",
          "state": {
            "Bentonite": "Bentonite",
            "Tofu": "Tofu",
            "Mixed": "Mixed"
          }

However, the hassfest workflow fails as a result of the select states being capitalized. Is it possible to soften the requirements for entity states or will the workflow only succeed if I rename the states (and in turn result in breaking changes for the end users of my component)?

Hassfest error output:

Error: R] [TRANSLATIONS] Invalid strings.json: Invalid translation key 'Bentonite', need to be [a-z0-9-_]+ and cannot start or end with a hyphen or underscore. for dictionary value @ data['entity']['select']['litter_type']['state']. Got {'Bentonite': 'Bentonite', 'Tofu': 'Tofu', 'Mixed': 'Mixed'}

Using component waze_travel_time but it's not in 'dependencies' or 'after_dependencies'

What is happening:

I have been struggling to get my custom integration through the hassfest validation. I have an import for WazeRouteCalculator and hassfest says:

[DEPENDENCIES] Using component waze_travel_time but it's not in 'dependencies' or 'after_dependencies'

What I don't understand:

I am using the WazeRouteCalculator project rather that the waze_travel_time integration. The waze_travel_time is using WazeRouteCalculator, but not the other way around. Why does it get pulled in to the check?

What I have tried:

If I do what it says and add waze_travel_time to the dependencies in manifest.json, then the Home Assistant startup reports:

2021-03-08 08:57:10 ERROR (MainThread) [homeassistant.setup] Setup failed for waze_travel_time: No setup function defined.
2021-03-08 08:57:23 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of person_location. Setup failed for dependencies: waze_travel_time

I have tried from WazeRouteCalculator import WazeRouteCalculator instead of import WazeRouteCalculator to cut down the import.

I have tried adding adding "WazeRouteCalculator>=0.12" to requirements instead of waze_travel_time in dependencies. This adds an additional error to the HACS validation, but at least Home Assistant starts normally:

❌ Python wheels (more-info: https://hacs.xyz/docs/publish/include#check-wheels )

This is in my development branch... https://github.com/rodpayne/home-assistant_person_location/tree/development.

Can you give me any ideas on where things are going wrong? (My integration, the waze_travel_time integration, a mixup in the name space, or the validation?)

Hassfest action failing on translations/json parsing (docker image)

When running hassfest as instructed (and we have it running for a while already) on a custom_component it errors on one of the json files for translation, e.g.

* [ERROR] [TRANSLATIONS] Invalid strings.json: extra keys not allowed (...)

example on custom component ci

In our instance for an otherwise working strings.json and translations/en.json file. Reproducing with manually building the docker image locally concur. Changing the Dockerfile to use home-assistant:dev instead of :beta does not yield this error. Didn't dive into it further since we also run the hassfest from a core-clone, but there is definitely something not correct in the current image on docker hub

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Hassfest Failure: Don't specify title in translation strings if it's a brand name

Hello,

I am getting the following error message from hassfest validation, which I can't find any more information about:

[TRANSLATIONS] Don't specify title in translation strings if it's a brand name or add exception to ALLOW_NAME_TRANSLATION

I thought removing the "title" string from translations would solve the problem, but it didn't.

h4de5/home-assistant-toshiba_ac@5dc7ccc

Any help or pointer in the right direction is appreciated.

hassfest fails with module not found for black

Running hassfest results in the following error:

Run docker run --rm -v /home/runner/work/philips-airpurifier-coap/philips-airpurifier-coap://github/workspace hassfest
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 7, in <module>
    from . import (
  File "/usr/src/homeassistant/script/hassfest/application_credentials.py", line 4, in <module>
    import black
ModuleNotFoundError: No module named 'black'
Error: Process completed with exit code 1.

Example: https://github.com/kongo09/philips-airpurifier-coap/actions/runs/3149559748/jobs/5121318558

Is that a problem of hassfest or did I do something wrong?

AttributeError: 'NoneType' object has no attribute 'get'

Hi, I tried to validate my component and get this error:


Validating manifest... done in 0.00s
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
Validating mqtt... done in 0.00s
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 235, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 162, in main
    plugin.validate(integrations, config)
  File "/usr/src/homeassistant/script/hassfest/requirements.py", line 60, in validate
    validate_requirements_format(integration)
  File "/usr/src/homeassistant/script/hassfest/requirements.py", line 83, in validate_requirements_format
    for req in integration.requirements:
  File "/usr/src/homeassistant/script/hassfest/model.py", line 166, in requirements
    return self.manifest.get("requirements", [])
AttributeError: 'NoneType' object has no attribute 'get'
Validating requirements...
Error: Process completed with exit code 1.

Integration:
https://github.com/RonnyWinkler/homeassistant.homey

It makes no difference if "requirements": [] is set in the manifest or not.
How can I fix this? Thanks for help and suggestions.
Ronny

Edit: Please wait. I think I missed a comma in the mainfest. I'll try again now...

Hassfest is failing with the latest 0.115.0b0 beta release

This is happening on my custom_component repo and on the template custom_component/blueprint repo too.

https://github.com/custom-components/blueprint/runs/1083586935?check_suite_focus=true#step:6:12

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/script/hassfest/__main__.py", line 7, in <module>
    from . import (
  File "/usr/src/homeassistant/script/hassfest/requirements.py", line 8, in <module>
    from stdlib_list import stdlib_list
ModuleNotFoundError: No module named 'stdlib_list'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.