Last active
October 21, 2022 20:13
-
-
Save grugnog/4e1c2452af2a746022d3ca6c08cee3d3 to your computer and use it in GitHub Desktop.
Count votes in Trello by person
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ -z "${TRELLO_API_KEY}" -o -z "${TRELLO_API_TOKEN}" ]; then | |
echo "Go to https://trello.com/app-key and export Personal Token as TRELLO_API_KEY, then manually generate a token and export as TRELLO_API_TOKEN" | |
exit 1 | |
fi | |
if [ -z "${1}" ]; then | |
echo "Provide the board ID (8 character alphanumeric from the URL) as an argument" | |
exit 2 | |
fi | |
board="${1}" | |
for id in $(curl -s "https://api.trello.com/1/boards/${board}/cards?key=${TRELLO_API_KEY}&token=${TRELLO_API_TOKEN}&limit=1000" | jq -r '.[] | .id'); do | |
curl -s "https://api.trello.com/1/cards/${id}/membersVoted?key=${TRELLO_API_KEY}&token=${TRELLO_API_TOKEN}" | jq '.[] | .fullName' | |
sleep 0.5 | |
done | sort | uniq -c | sort -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment