I'm getting a list of feature/*
branches from my repository in a GitHub action using:
echo ::set-output name=branches::$( git branch -r | grep -i "feature/" | sed -e "s/.*origin\///" | tr "\n" " " )
However, this list is String output and I need it in a String array so I can use it to call another workflow using the Matrix strategy.
I've tried numerous tactics including:
()
which results in a syntax error ("unexpected token: (
")()
using:
branches=($( git branch -r | grep -i "feature/" | sed -e "s/.*origin\///" | tr "\n" " " ))
with:
echo ::set-output name=branches::${branches[@]} # also ${branches[*]}
gives an error with both values: "Unexpected type of value 'feature/quality-3 feature/test_feature', expected type: Sequence."
with:
echo ::set-output name=branches::${branches} # or $branches
gives an error with 1 value: "Unexpected type of value 'feature/quality-3', expected type: Sequence."
You have to pass such data as a JSON between jobs:
Use combination of:
Here is a full example from GitHub.