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?
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..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With