Skip to content

Instantly share code, notes, and snippets.

@linyows
Created March 29, 2017 03:44
Show Gist options
  • Save linyows/5e3bdc11eb2c7c994a0985d11bb8e039 to your computer and use it in GitHub Desktop.
Save linyows/5e3bdc11eb2c7c994a0985d11bb8e039 to your computer and use it in GitHub Desktop.
#!/bin/bash
pr_id=$(git log | grep 'Merge pull request' | head -n 1 | sed -e 's/[^0-9]//g')
repo=$(git remote get-url origin | sed -e 's/ssh:\/\/git@.*\/\(.*\)\/\(.*\).git/\1\/\2/')
title=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
${GITHUB_API}repos/${repo}/pulls/${pr_id} | grep title | sed -e 's/.*".*": "\(.*\)",/\1/g')
echo $title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment