@@ -12,53 +12,40 @@ jobs:
1212 name : Label Check
1313 runs-on : ubuntu-latest
1414 outputs :
15- labels : ${{ steps.find_labels .outputs.labels }}
15+ label : ${{ steps.find_label .outputs.label }}
1616 steps :
17- - name : Read PR Body and Determine Labels
18- id : find_labels
17+ - name : Determine Single Label
18+ id : find_label
1919 run : |
20- # We'll collect labels in a space-separated list:
21- labels=""
22-
2320 body="${{ github.event.pull_request.body }}"
2421
25- # 1) Bugfix label
22+ # We'll check each pattern in order. The first match wins, ignoring the rest.
23+ label=""
2624 if echo "$body" | grep -qE '- \\[x\\] Bugfix \\(fixed change that fixes an issue\\)'; then
27- labels="$labels bugfix"
28- fi
29-
30- # 2) New feature
31- if echo "$body" | grep -qE '- \\[x\\] New feature \\(thanks!\\)'; then
32- labels="$labels new-feature"
33- fi
34-
35- # 3) Breaking change
36- if echo "$body" | grep -qE '- \\[x\\] Breaking change \\(repair/feature that breaks existing functionality\\)'; then
37- labels="$labels breaking-change"
25+ label="bugfix"
26+ elif echo "$body" | grep -qE '- \\[x\\] New feature \\(thanks!\\)'; then
27+ label="new-feature"
28+ elif echo "$body" | grep -qE '- \\[x\\] Breaking change \\(repair/feature that breaks existing functionality\\)'; then
29+ label="breaking-change"
30+ elif echo "$body" | grep -qE '- \\[x\\] Dependency Update - Does not publish'; then
31+ label="dependency-update"
3832 fi
3933
40- # 4) Dependency update
41- if echo "$body" | grep -qE '- \\[x\\] Dependency Update - Does not publish'; then
42- labels="$labels dependency-update"
43- fi
44-
45- # Trim leading/trailing spaces
46- labels="$(echo "$labels" | xargs)"
47-
48- echo "Found labels: '$labels'"
49- echo "labels=$labels" >> $GITHUB_OUTPUT
34+ echo "Selected label: $label"
35+ echo "label=$label" >> $GITHUB_OUTPUT
5036
51- - name : Add Labels
52- if : ${{ steps.find_labels .outputs.labels }}
37+ - name : Add Single Label if Found
38+ if : ${{ steps.find_label .outputs.label != '' }}
5339 uses : actions-ecosystem/action-add-labels@v1
5440 with :
5541 github_token : ${{ secrets.GITHUB_TOKEN }}
56- labels : ${{ steps.find_labels.outputs.labels }}
42+ labels : ${{ steps.find_label.outputs.label }}
43+
5744 ci :
58- name : Building ${{ matrix.file }}
45+ name : ESPHome Build
5946 runs-on : ubuntu-latest
47+ needs : label-check
6048 strategy :
61- fail-fast : false
6249 matrix :
6350 file :
6451 - Integrations/ESPHome/PLT-1.yaml
6855 - beta
6956 - dev
7057 steps :
71- - name : Checkout source code
72- 73- - name : Build ESPHome firmware to verify configuration
58+ - name : Checkout
59+ uses : actions/checkout@v4
60+
61+ - name : Build ESPHome firmware
7462 uses : esphome/build-action@v6
7563 with :
7664 yaml-file : ${{ matrix.file }}
0 commit comments