Skip to content

Commit

Permalink
Merge cross-rs#744
Browse files Browse the repository at this point in the history
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 <ahuszagh@gmail.com>
  • Loading branch information
bors[bot] and Alexhuszagh authored Jun 2, 2022
2 parents 1312fca + 7c090d5 commit 87a322e
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,26 @@ jobs:
declare -a "bors_args=(${bors_args})"
fi
if [[ "${bors_args[0]-}" == --target ]]; then
echo "Only running targets matching '${bors_args[1]}'."
matrix="$(
target="${bors_args[1]}" yq --output-format json '[.[] | select(.target | test(env(target)))]' <<< "${matrix}"
)"
targets=()
index=0
while [[ "${bors_args[$index]-}" == --target ]]; do
index=$(expr $index + 1)
targets+=("${bors_args[$index]}")
index=$(expr $index + 1)
done
selects=()
for target in "${targets[@]}"; do
selects+=(".target == \"${target}\"")
done
query=$(printf " or %s" "${selects[@]}")
query="${query:4}"
if [[ "${#targets[@]}" != "0" ]]; then
echo "Only running targets matching '${targets[@]}'."
matrix=$(
yq --output-format json '[.[] | select('"${query}"')]' <<< "${matrix}"
)
else
echo 'Running all targets.'
matrix="$(yq --output-format json <<< "${matrix}")"
Expand Down

0 comments on commit 87a322e

Please sign in to comment.