Skip to content

Instantly share code, notes, and snippets.

@bencooper222
Created December 14, 2021 21:40
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 bencooper222/7c233eb0881b31e86cbe45bf07c08cd2 to your computer and use it in GitHub Desktop.
Save bencooper222/7c233eb0881b31e86cbe45bf07c08cd2 to your computer and use it in GitHub Desktop.
Opens the circleci (assuming github) workflow for the repo/branch your working directory is in
inside_git_repo="$(git rev-parse --is-inside-work-tree 2>/dev/null)"
if [ ! "$inside_git_repo" ]; then
echo "not in git repo"
exit
fi
BRANCH="$(git rev-parse --abbrev-ref HEAD | tr -d '\n' | xargs | jq -sRr @uri | sed -e "s/%0A$//")"
# if your origin isn't ssh, this probably won't work
REMOTE="$(git config --get remote.origin.url | xargs | cut -d ":" -f2 | sed -e "s/.git$//")"
# echo $BRANCH
# echo $REMOTE
URL="https://app.circleci.com/pipelines/github/$REMOTE?branch=$BRANCH&filter=all"
# echo $URL
open $URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment