Skip to content

[IT] Add support for HassListAdditem (#2531) #7697

[IT] Add support for HassListAdditem (#2531)

[IT] Add support for HassListAdditem (#2531) #7697

Workflow file for this run

---
name: CI
# yamllint disable-line rule:truthy
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
pull-requests: read
concurrency:
# yamllint disable-line rule:line-length
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- run: script/setup
- run: python3 -m script.intentfest add_language test_add_language_generates_valid_data "CI Added Language"
- name: Register intentfest problem matcher
run: |
echo "::add-matcher::.github/workflows/matchers/intentfest.json"
- run: script/lint
- name: Get changed files
if: github.event_name == 'pull_request'
id: changed-files
uses: tj-actions/changed-files@v45
with:
json: true
escape_json: false
- name: Extract affected languages
if: github.event_name == 'pull_request'
id: extract-languages
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "::group::Get changed files"
echo $CHANGED_FILES
echo "::endgroup::"
# Check if any files outside language directories were changed
if echo "$CHANGED_FILES" | jq -r '.[]' | grep -qvE '^(sentences|responses|tests)/'; then
echo "Running full tests due to changes outside language directories"
exit 0
fi
# Get unique language codes from changed files
LANGUAGES=$(echo "$CHANGED_FILES" | jq -r '.[]' | \
grep -oE '^(sentences|responses|tests)/([^/ ]+)/' | \
cut -d'/' -f2 | sort -u | tr '\n' ',' | sed 's/,$//')
if [ -n "$LANGUAGES" ]; then
echo "languages=$LANGUAGES" | tee -a $GITHUB_OUTPUT
fi
- name: Run tests
env:
is_pr: ${{ github.event_name == 'pull_request' }}
run: |
if [ "$is_pr" = "true" ] && [ -n "${{ steps.extract-languages.outputs.languages }}" ]; then
script/test --language ${{ steps.extract-languages.outputs.languages }}
else
script/test
fi
- run: python3 -m script.intentfest parse --language en --sentence 'turn on the lights in the kitchen'
- run: python3 -m script.intentfest codeowners --check