Skip to content

Instantly share code, notes, and snippets.

@rparrett
Created October 19, 2022 23:03
Show Gist options
  • Save rparrett/46e434ba1fec127738fa8932f9e1d482 to your computer and use it in GitHub Desktop.
Save rparrett/46e434ba1fec127738fa8932f9e1d482 to your computer and use it in GitHub Desktop.
Generate Bevy migration guide stub
#!/usr/bin/env zsh
# TODO not sure why this doesn't work in bash
if ! hash markdown-extract &> /dev/null
then
echo "markdown-extract required"
echo "cargo install markdown-extract"
exit 1
fi
if ! hash gh &> /dev/null
then
echo "github cli required"
echo "https://github.com/cli/cli"
exit 1
fi
echo > out.md
for PR in $(git log 'v0.8.0'..HEAD --oneline | grep -o '(#\d\+)' | grep -o '\d\+')
do
TEXT=$(gh pr view $PR)
TITLE=$(echo $TEXT | head -n 1 | sed 's/^.*Bors\] - //')
OUT=$(echo $TEXT | markdown-extract -n "Migration Guide" /dev/stdin)
if [ $? -eq 0 ]; then
echo "\n### [$TITLE](https://github.com/bevyengine/bevy/pull/$PR)\n" >> out.md
echo $OUT >> out.md
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment