Skip to content

Commit 87a322e

Browse files
Merge #744
744: Add support for multiple bors targets. r=Emilgardis a=Alexhuszagh Allow using `bors try --target ... --target ...`, allowing multiple arguments rather than just a single one. Co-authored-by: Alex Huszagh <[email protected]>
2 parents 1312fca + 7c090d5 commit 87a322e

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,26 @@ jobs:
9292
declare -a "bors_args=(${bors_args})"
9393
fi
9494
95-
if [[ "${bors_args[0]-}" == --target ]]; then
96-
echo "Only running targets matching '${bors_args[1]}'."
97-
matrix="$(
98-
target="${bors_args[1]}" yq --output-format json '[.[] | select(.target | test(env(target)))]' <<< "${matrix}"
99-
)"
95+
targets=()
96+
index=0
97+
while [[ "${bors_args[$index]-}" == --target ]]; do
98+
index=$(expr $index + 1)
99+
targets+=("${bors_args[$index]}")
100+
index=$(expr $index + 1)
101+
done
102+
103+
selects=()
104+
for target in "${targets[@]}"; do
105+
selects+=(".target == \"${target}\"")
106+
done
107+
query=$(printf " or %s" "${selects[@]}")
108+
query="${query:4}"
109+
110+
if [[ "${#targets[@]}" != "0" ]]; then
111+
echo "Only running targets matching '${targets[@]}'."
112+
matrix=$(
113+
yq --output-format json '[.[] | select('"${query}"')]' <<< "${matrix}"
114+
)
100115
else
101116
echo 'Running all targets.'
102117
matrix="$(yq --output-format json <<< "${matrix}")"

0 commit comments

Comments
 (0)