Skip to content

Commit d0b991f

Browse files
authored
Merge pull request #4991 from input-output-hk/newhoggy/in-merge-summary-construct-correct-pr-link
In merge summary construct correct pr link
2 parents a0aa633 + 630c46b commit d0b991f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

scripts/gen-merge-summary.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/usr/bin/env bash
22

3-
since="$1"
4-
until="$(date -d "$since +7 days" +%Y-%m-%d)"
3+
if [ $# -eq 0 ]; then
4+
>&2 echo "gen-merge-summary.sh [SINCE] [UNTIL]"
5+
>&2 echo "Generate a merge summary between the SINCE and UNTIL date"
6+
>&2 echo ""
7+
>&2 echo "Examples:"
8+
>&2 echo " gen-merge-summary.sh 2023-01-01 2023-01-08"
9+
>&2 echo " gen-merge-summary.sh 2023-01-01 '2023-01-01 +7 days'"
10+
exit 1
11+
fi
12+
13+
since="$(date -d "$1" +%Y-%m-%d)"
14+
until="$(date -d "$2" +%Y-%m-%d)"
515

616
echo "# Merge summary for $since to $until"
717

@@ -13,6 +23,6 @@ git log --merges --since $since --until $until --format=fuller \
1323
| (.subject = (.message | split("\n"))[0])
1424
| (.body = (.message | split("\n") | del(.[0]) | del(.[0]) | join("\n")))
1525
| select(.subject | startswith("Merge pull request #"))
16-
| (.subject |= sub("^.*#"; ""))
26+
| (.subject |= sub("^.*#(?<a>[0-9]+) .*$"; .a))
1727
| ("- [" + (.body | gsub("\n.*"; "")) + "](https://github.com/input-output-hk/cardano-node/pull/" + .subject + ") (" + .author + ")")
1828
'

0 commit comments

Comments
 (0)