mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 14:04:53 +01:00
c296b4c348
* Add PR labels based on files changed * Remove platform code
29 lines
603 B
Bash
Executable file
29 lines
603 B
Bash
Executable file
#!/bin/bash
|
|
|
|
components=()
|
|
for c_diff in $(git diff ${1}..${2} --name-only esphome/components); do
|
|
base=${c_diff#esphome/components/}
|
|
component=`dirname ${base}`
|
|
|
|
if [[ "${component}" == "." ]]; then
|
|
component=${platform}
|
|
fi
|
|
|
|
if [[ ! "${components[@]}" =~ "${component}" ]]; then
|
|
components+=($component)
|
|
fi
|
|
done
|
|
|
|
labels=()
|
|
|
|
echo "Components:"
|
|
for component in ${components[@]}; do
|
|
echo " ${component}"
|
|
labels+=("component: $component")
|
|
done
|
|
|
|
echo "Labels: ${labels[@]}"
|
|
|
|
output=$(printf '%s\n' "${labels[@]}" | jq -R . | jq -c -s .)
|
|
|
|
echo "::set-output name=labels::${output}"
|