Created
June 5, 2017 15:21
-
-
Save jpopesculian/07d02d52cf09e64c5561179561a94536 to your computer and use it in GitHub Desktop.
Get current sprint using node-jira
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
#!/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