Skip to content

Instantly share code, notes, and snippets.

@jonmchan
Created January 11, 2024 17:58
Show Gist options
  • Save jonmchan/c132c3a56b506dda876c35bf184ec054 to your computer and use it in GitHub Desktop.
Save jonmchan/c132c3a56b506dda876c35bf184ec054 to your computer and use it in GitHub Desktop.
Generate Release Notes From Merged PRs
#!/bin/bash
## Looks for the last release that was merged into master with the name "release", this allows for hotfixes to be included in the PR Changelog
last_release=`gh pr list -s merged --base master|grep 'release'|awk 'NR==1{print $1}'`
merged_prs=`gh pr list -s merged --limit 10 --search sort:updated-desc --json number,title --template '{{range .}}{{printf "#%.0f \n" .number}}{{end}}' |sed "/$last_release/q"`
formatted_prs=`echo "$merged_prs"| awk '{print " - " $0}'`
pr_body="## Features & Bug Fixes"$'\n'
pr_body+=""$'\n'
pr_body+="$formatted_prs"$'\n'
pr_body+=""$'\n'
pr_body+="## Post-Deployment Tasks"$'\n'
pr_body+=""$'\n'
pr_body+="- [ ] Insert Post Deployment tasks here"$'\n'
pr_body+="- [ ] Or remove this list..."$'\n'
pr_body+="- [ ] If there isn't any post-deployment things to do"$'\n'
pr_body+=""$'\n'
echo "$pr_body"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment