Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ jobs:
run: |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'require-dev-pass') }}" == "true" ]]; then
echo "strict_dev=true" >> $GITHUB_OUTPUT

else
echo "strict_dev=false" >> $GITHUB_OUTPUT
fi
Expand Down Expand Up @@ -77,16 +76,30 @@ jobs:
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-hacore
${{ env.CACHE_VERSION}}-${{ runner.os }}
${{ env.CACHE_VERSION}}
- name: Set-up environment
- name: Install pre-commit dependencies
run: |
scripts/setup.sh
if [ -z "$VIRTUAL_ENV" ]; then
if [ -x "$(command -v uv)" ]; then
uv venv --seed venv
else
python3 -m venv venv
fi
# shellcheck disable=SC1091 # ingesting virtualenv
source venv/bin/activate
fi

if ! [ -x "$(command -v uv)" ]; then
python3 -m pip install uv pre-commit
fi
- name: Install pre-commit dependencies
run: |
. venv/bin/activate
# shellcheck disable=SC1091 # ingesting virtualenv
source venv/bin/activate
pre-commit install-hooks
- name: Run all-files pre-commit excluding testing
run: |
. venv/bin/activate
# shellcheck disable=SC1091 # ingesting virtualenv
source venv/bin/activate
pre-commit run --all-files --show-diff-on-failure
env: # While not problematic, save time on performing the local hooks as they are run from the complete script in the next job
SKIP: local-test-core-prep,local-test-pip-prep,local-testing,local-quality
Expand Down Expand Up @@ -212,6 +225,11 @@ jobs:
RELEASE_TESTS_FAILED="${{ needs.ha-core-release.outputs.release_failed }}"
FAIL_COUNT=0

# Get the action-bot's latest state
LAST_REVIEW_STATE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews" \
| jq -r '[.[] | select(.user.login=="github-actions[bot]")] | last | .state')

if [[ $DEV_TESTS_FAILED == "true" ]]; then
COMMENT_BODY=":x: **Error while testing for Development HA-core:**\n\n"
else
Expand Down Expand Up @@ -242,6 +260,21 @@ jobs:
COMMENT_BODY+=":heavy_check_mark: **Success:** No problem with testing against released HA-core.\n"
fi

# If everything is OK, don't approve - if requested changes before and everything is good now, approve
# to release the 'requested changes' bit
if [[ $FAIL_COUNT -eq 0 ]]; then
if [[ "$LAST_REVIEW_STATE" == "CHANGES_REQUESTED" ]]; then
echo "Lifting previous changes requested — submitting approval."
curl -s -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
--data "{\"event\": \"APPROVE\", \"body\": \"$COMMENT_BODY\"}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews"
else
echo "No prior changes requested — skipping approval."
fi
fi

if [[ $FAIL_COUNT -eq 1 ]]; then
echo "Comment and approve the pull request"
curl -s -X POST \
Expand All @@ -250,6 +283,7 @@ jobs:
--data "{\"event\": \"APPROVE\", \"body\": \"$COMMENT_BODY\"}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews"
fi

if [[ $FAIL_COUNT -eq 2 ]]; then
echo "Requesting changes on the pull request"
curl -s -X POST \
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ repos:
hooks:
- id: yamllint
name: "Linting yaml"
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
name: "Shell checking"
args:
- --external-sources
- repo: https://github.com/biomejs/pre-commit
rev: v1.9.4
hooks:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

Versions from 0.40 and up

## Ongoing
## v0.58.0

- Downstream HA [Core PR](https://github.com/home-assistant/core/pull/138201) update signature of platforms' async_setup_entry
- Maintenance chores
- Minimum python to 3.13 following HA

## v0.57.1

Expand Down
Loading
Loading