File: pr2relnotes.sh

package info (click to toggle)
rebar3 3.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,692 kB
  • sloc: erlang: 47,856; sh: 947; makefile: 91
file content (25 lines) | stat: -rwxr-xr-x 609 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env sh

if [ -z $1 ]
then
    echo "usage: $0 <tag> [pull-request-url]"
    exit 0
fi
export url=${2:-"https://github.com/erlang/rebar3/pull/"}

git log --merges --pretty=medium $1..HEAD | \
awk -v url=$url '
    # first line of a merge commit entry
    /^commit / {mode="new"}

    # merge commit default message
    mode=="new" && / +Merge pull request/ {
        page_id=substr($4, 2, length($4)-1);
        mode="started";
        next;
    }

    # line of content including title
    mode=="started" && /    [^ ]+/ {
        print "- [" substr($0, 5) "](" url page_id ")"; mode="done"
    }'