Update checks workflow (#2677)

This commit is contained in:
Joakim Sørensen
2024-08-29 08:04:26 +02:00
committed by GitHub
parent 6b3eb9c270
commit ad3db8420d
+14 -40
View File
@@ -1,4 +1,5 @@
name: "Checks"
name: Check
on:
pull_request:
types:
@@ -10,13 +11,9 @@ on:
- master
paths:
- appdaemon
- blacklist
- critical
- integration
- netdaemon
- plugin
- python_script
- removed
- template
- theme
@@ -24,14 +21,15 @@ concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
preflight:
runs-on: ubuntu-latest
name: Initialize
name: Preflight
outputs:
repository: ${{ steps.repository.outputs.repository }}
category: ${{ steps.category.outputs.category }}
removal: ${{ steps.removal.outputs.removal }}
steps:
- name: Check out repository
uses: actions/checkout@v4.1.7
@@ -43,24 +41,14 @@ jobs:
id: repository
run: echo "repository=$(python3 -m scripts.changed.repo)" >> $GITHUB_OUTPUT
- name: Check removal
id: removal
run: |
if [ "${{ steps.repository.outputs.repository }}" == "Bad data []" ]; then
echo "removal=true" >> $GITHUB_OUTPUT
fi
- name: Set category
if: steps.removal.outputs.removal != 'true'
id: category
run: echo "category=$(python3 -m scripts.changed.category)" >> $GITHUB_OUTPUT
owner:
runs-on: ubuntu-latest
name: Check Owner
name: Owner
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: Check out repository
uses: actions/checkout@v4.1.7
@@ -74,9 +62,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{needs.preflight.outputs.repository}}
edits:
editable:
runs-on: ubuntu-latest
name: Check if PR is editable
name: Editable PR
steps:
- name: Check out repository
uses: actions/checkout@v4.1.7
@@ -87,10 +75,9 @@ jobs:
- name: Run the check
run: python3 -m scripts.check.edits
hassfest:
runs-on: ubuntu-latest
name: "Check hassfest"
name: Hassfest
needs: preflight
if: needs.preflight.outputs.category == 'integration'
steps:
@@ -98,37 +85,24 @@ jobs:
uses: actions/checkout@v4.1.7
- name: Clone new addition
if: steps.removal.outputs.removal != 'true'
run: |
git clone --depth 1 "https://github.com/${{needs.preflight.outputs.repository}}" /tmp/repositories/addition
- name: Get hassfest action
run: |
git clone --depth 1 https://github.com/home-assistant/actions.git /tmp/actions
echo "::add-matcher::/tmp/actions/hassfest/problem-matcher.json"
- name: Enable problem-matcher
run: echo "::add-matcher::/tmp/actions/hassfest/problem-matcher.json"
- name: Build hassfest
run: docker build /tmp/actions/hassfest -f /tmp/actions/hassfest/Dockerfile -t hassfest
- name: Run hassfest
run: |
integration=$(python3 -m scripts.helpers.integration_path)
domain=$(python3 -m scripts.helpers.domain)
docker run \
--rm \
docker run --rm \
-v "$integration":"/github/workspace/$domain" \
hassfest
ghcr.io/home-assistant/hassfest:latest
hacs:
runs-on: ubuntu-latest
name: "Run HACS Action"
name: HACS action
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: HACS action
uses: "hacs/action@main"
uses: hacs/action@main
with:
repository: ${{needs.preflight.outputs.repository}}
category: ${{needs.preflight.outputs.category}}