Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In merge summary construct correct pr link #4991

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions scripts/gen-merge-summary.sh
Original file line number Diff line number Diff line change
@@ -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 + ")")
'