-
Notifications
You must be signed in to change notification settings - Fork 1.2k
162 lines (136 loc) · 4.24 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Check
on:
pull_request:
types:
- opened
- synchronize
- reopened
- unlabeled
branches:
- master
paths:
- appdaemon
- integration
- plugin
- python_script
- template
- theme
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
preflight:
runs-on: ubuntu-latest
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/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version-file: ".python-version"
- name: Clone origin
run: git clone --depth 1 https://github.com/hacs/default /tmp/repositories/default
- name: Set repository
id: repository
run: echo "repository=$(python3 -m scripts.changed.repo)" >> $GITHUB_OUTPUT
- name: Set category
id: category
run: echo "category=$(python3 -m scripts.changed.category)" >> $GITHUB_OUTPUT
- name: Check removal
id: removal
run: |
if [ "${{ steps.repository.outputs.repository }}" == "Bad data []" ]; then
echo "removal=true" >> $GITHUB_OUTPUT
fi
owner:
runs-on: ubuntu-latest
name: Owner
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version-file: ".python-version"
cache: "pip"
cache-dependency-path: "requirements.txt"
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.owner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{needs.preflight.outputs.repository}}
editable:
runs-on: ubuntu-latest
name: Editable PR
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version-file: ".python-version"
cache: "pip"
cache-dependency-path: "requirements.txt"
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.edits
removed:
runs-on: ubuntu-latest
name: Removed repository
needs: preflight
if: needs.preflight.outputs.removal != 'true'
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version-file: ".python-version"
cache: "pip"
cache-dependency-path: "requirements.txt"
- name: Install dependencies if needed
run: scripts/setup
- name: Run the check
run: python3 -m scripts.check.removed
env:
REPOSITORY: ${{needs.preflight.outputs.repository}}
hassfest:
runs-on: ubuntu-latest
name: Hassfest
needs: preflight
if: needs.preflight.outputs.category == 'integration' && needs.preflight.outputs.removal != 'true'
steps:
- name: Check out repository
uses: actions/[email protected]
- name: Clone new addition
run: |
git clone --depth 1 "https://github.com/${{needs.preflight.outputs.repository}}" /tmp/repositories/addition
- 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" \
ghcr.io/home-assistant/hassfest:latest
hacs:
runs-on: ubuntu-latest
name: 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}}