Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created May 31, 2023 21:11
Show Gist options
  • Save KyMidd/c1f3cb12a51781d2cb5b09ffa962efca to your computer and use it in GitHub Desktop.
Save KyMidd/c1f3cb12a51781d2cb5b09ffa962efca to your computer and use it in GitHub Desktop.
# Print out list of pods we'll be targeting
echo "We'll be targeting the following pods:"
while IFS=$'\n' read -r POD; do
echo "- $POD"
done <<< "$TARGETED_PODS"
# Remove old file and put all pods into list like: 'pod1','pod2','pod3'
rm -f TARGETED_PODS_HOLDER
while IFS=$'\n' read -r POD; do
printf "'$POD'", >> TARGETED_PODS_HOLDER
done <<< "$TARGETED_PODS"
# Read file as var and remove trailing comma
TARGETED_PODS_OUTPUT=$(cat TARGETED_PODS_HOLDER | sed 's/,$//')
# Send TARGETED_PODS to output
echo "TARGETED_PODS=[${TARGETED_PODS_OUTPUT}]" >> $GITHUB_OUTPUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment