Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the title of a Pull Request from command line

I'm writing a continuous integration step that checks the titles of our pull requests for proper tags and formatting before allowing them to be merged.

To do this, I need to echo the title of the Pull Request when given the PR number. Is there a way to do this simply in command line?

like image 387
Danny Delott Avatar asked Jan 04 '16 22:01

Danny Delott


1 Answers

building off of @Simon-Warta's answer you can do the following:

git clone https://github.com/user_org/project.git
pushd project
for pr in $(git log --pretty="%s" --merges | grep pull | sed -e "s/.*#\([0-9]\+\).*/\1/g" | sort -rn | uniq); do
  curl https://api.github.com/repos/user_org/project/pulls/${pr} 2>/dev/null | jq '.title';
done
popd

You'll need curl and jq available on your machine but that shouldn't be hard if you have a reasonable linux distro..

like image 145
Kevin Kreiser Avatar answered Sep 24 '22 03:09

Kevin Kreiser