-
-
Save kuahyeow/4197842 to your computer and use it in GitHub Desktop.
Returns the title of the beetil your branch is on
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
export beetil_api_key=YOUR_BEETIL_API_KEY_HERE | |
# extracts the branch name | |
function plain_git_branch { | |
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///' | |
} | |
# extracts the part of the branch name that could be a beetil number | |
function beetil_number_from_git_branch { | |
plain_git_branch 2> /dev/null | cut -c2-9 | |
} | |
function beetil { | |
curl -s "https://x:[email protected]/desk/external_api/v1/changes/$(beetil_number_from_git_branch)" | grep -Po '"title":.*?[^\\]"[,}]' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment