Skip to content

Commit

Permalink
In merge summary construct correct PR link and improve argument handl…
Browse files Browse the repository at this point in the history
…ing and help.
  • Loading branch information
newhoggy committed Mar 17, 2023
1 parent a0aa633 commit 630c46b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions scripts/gen-merge-summary.sh
@@ -1,7 +1,17 @@
#!/usr/bin/env bash

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

since="$(date -d "$1" +%Y-%m-%d)"
until="$(date -d "$2" +%Y-%m-%d)"

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

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

0 comments on commit 630c46b

Please sign in to comment.