Skip to content

Instantly share code, notes, and snippets.

@maxme
Created September 20, 2019 12:24
Show Gist options
  • Save maxme/099c09e3491a1d8d03700bfe10bc026e to your computer and use it in GitHub Desktop.
Save maxme/099c09e3491a1d8d03700bfe10bc026e to your computer and use it in GitHub Desktop.
List tickets from a specific column of a specific project board
#!/bin/bash
## PARAMETERS
AUTH_TOKEN=
PROJECT_NAME="Mobile Gutenberg"
COLUMN_NAME="Open Beta"
### DON'T CHANGE BELOW THIS LINE
TMP_DIR=`mktemp -d`
BETA="Accept: application/vnd.github.inertia-preview+json"
AUTH="Authorization: token $AUTH_TOKEN"
## Get column url
columns_url=`curl -s -H "$BETA" -H "$AUTH" https://api.github.com/orgs/wordpress-mobile/projects | jq ".[] | select(.name == \"$PROJECT_NAME\") | .columns_url" | sed 's/"//g'`
## Get cards url
cards_url=`curl -s -H "$BETA" -H "$AUTH" $columns_url | jq ".[] | select(.name == \"$COLUMN_NAME\") | .cards_url" | sed 's/"//g'`
## Get Cards
curl -s -H "$BETA" -H "$AUTH" $cards_url > $TMP_DIR/cards.json
## Get tickets from cards
cat $TMP_DIR/cards.json | jq ".[].content_url" | xargs curl -s -H "$BETA" -H "$AUTH" > $TMP_DIR/tickets.json
## Extract title / urls from tickets
# cat $TMP_DIR/tickets.json | jq "{title:.title,url:.html_url}"
## Format it for https://www.planitpoker.com
cat $TMP_DIR/tickets.json | jq -r ".title+\" - \"+.url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment