Skip to content

Instantly share code, notes, and snippets.

@jpopesculian
Created June 5, 2017 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpopesculian/07d02d52cf09e64c5561179561a94536 to your computer and use it in GitHub Desktop.
Save jpopesculian/07d02d52cf09e64c5561179561a94536 to your computer and use it in GitHub Desktop.
Get current sprint using node-jira
#!/bin/bash
CACHE=$HOME/.sprintcache
function updatecache {
sprint=$(jira sprint \
| grep ACTIVE \
| awk '{split($0,a,"│"); gsub(/^[ \t]+/, "", a[3]); gsub(/[ \t]+$/, "", a[3]); print a[3]}')
echo "Updated Active Sprint -> $sprint"
echo -n $sprint > $CACHE
}
if [ ! -f $CACHE ]; then
updatecache
fi
modified=$(stat $CACHE | grep Modify | awk '{split($0,a,": "); print a[2]}')
modified_time=$(date -ud "$modified" +'%s')
now_time=$(date +'%s')
diff=`expr $now_time - $modified_time`
DAY=86400
if [ $diff -gt $DAY ]; then
updatecache
fi
sprint=$(cat $CACHE | xargs)
jira sprint -s "$sprint"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment