Files
default/.github/workflows/checks.yml
T
dependabot[bot]andJoakim Sørensen cdbfacc468 Bump actions/checkout from 2 to 3.5.0 (#1832)
* Bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
2023-04-09 13:11:57 +02:00

152 lines
4.1 KiB
YAML

name: "Checks"
on:
pull_request:
types:
- opened
- synchronize
- reopened
- unlabeled
branches:
- master
paths:
- appdaemon
- blacklist
- critical
- integration
- netdaemon
- plugin
- python_script
- removed
- template
- theme
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true
jobs:
preflight:
runs-on: ubuntu-latest
name: Initialize
outputs:
repository: ${{ steps.repository.outputs.repository }}
category: ${{ steps.category.outputs.category }}
removal: ${{ steps.removal.outputs.removal }}
steps:
- name: Check out repository
uses: actions/checkout@v3.5.0
- name: Clone origin
run: git clone --depth 1 https://github.com/hacs/default /tmp/repositories/default
- name: Set repository
id: repository
run: echo "::set-output name=repository::$(python3 -m scripts.changed.repo)"
- name: Check removal
id: removal
run: |
if [ "${{ steps.repository.outputs.repository }}" == "Bad data []" ]; then
echo "::set-output name=removal::true"
fi
- name: Set category
if: steps.removal.outputs.removal != 'true'
id: category
run: echo "::set-output name=category::$(python3 -m scripts.changed.category)"
- name: Clone new addition
if: steps.removal.outputs.removal != 'true'
run: |
repo=$(python3 -m scripts.changed.repo)
git clone --depth 1 "https://github.com/$repo" /tmp/repositories/addition
- name: Upload shared artifacts
if: steps.removal.outputs.removal != 'true'
uses: actions/upload-artifact@master
with:
name: repositories
path: /tmp/repositories
owner:
runs-on: ubuntu-latest
name: Check Owner
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: Check out repository
uses: actions/checkout@v3.5.0
- name: Download shared artifacts
uses: actions/download-artifact@master
with:
name: repositories
path: /tmp/repositories
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.owner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
edits:
runs-on: ubuntu-latest
name: Check if PR is editable
steps:
- name: Check out repository
uses: actions/checkout@v3.5.0
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.edits
hassfest:
runs-on: ubuntu-latest
name: "Check hassfest"
needs: preflight
if: needs.preflight.outputs.category == 'integration'
steps:
- name: Check out repository
uses: actions/checkout@v3.5.0
- name: Download shared artifacts
uses: actions/download-artifact@v1
with:
name: repositories
path: /tmp/repositories
- 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 \
-v "$integration":"/github/workspace/$domain" \
hassfest
hacs:
runs-on: ubuntu-latest
name: "Run HACS Action"
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: HACS action
uses: "hacs/action@main"
with:
repository: ${{needs.preflight.outputs.repository}}
category: ${{needs.preflight.outputs.category}}