Skip to content

Commit

Permalink
fix: fix bug fixes section
Browse files Browse the repository at this point in the history
  • Loading branch information
oderayi committed Jan 29, 2024
1 parent bdd3e2f commit 38cafb8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/scripts/generate-release-note.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Description: This script is used to generate release note for a release.
# Dependencies: This script depends on the changelog files (.tmp/changelogs/**) and environment variables generated by the generate-changelog.sh script.
# Requirements: bash >= v4.0.0, jq, curl, git, helm, mo
# Usage: .github/workflows/scripts/generate-release-note.sh release_name release_version last_release_tag ttk-test-cases-version example-backend-version
# Usage: .github/workflows/scripts/generate-release-note.sh 'release_name' 'release_version' 'last_release_tag' 'ttk-test-cases-version' 'example-backend-version'
# Environment variables: AUTO_RELEASE_TOKEN

set -e
Expand Down Expand Up @@ -79,6 +79,7 @@ fi
######################
# Global variables #
######################

declare -A last_release_tags
declare -A current_tags

Expand Down Expand Up @@ -124,7 +125,6 @@ release_summary_points() {

# Generate "New Features" section of the release note
new_features() {
new_features=""
for file in $dir/changelogs/*.json
do
repository=$(basename $file | cut -d'.' -f1)
Expand All @@ -145,14 +145,22 @@ new_features() {

# Generate "Bug Fixes" section of the release note
bug_fixes() {
bug_fixes=""
for file in $dir/changelogs/*.json
do
repository=$(basename $file | cut -d'.' -f1)
bug_fixes+=$(cat $file | jq -r '.commits[].commit | select(.message | startswith("fix(")) .message | split("\n")[0] as $pr_title | "* \($pr_title)"' | sort -u)
pr_title=$(cat $file | jq -r '.commits[].commit | select(.message | startswith("fix")) .message | split("\n")[0] as $pr_title | "* \($pr_title)"')
echo "$pr_title" | while IFS= read -r line
do
description=$(echo "$line" | awk -F ': ' '{print $2}' | awk -F ' \\(#' '{print $1}')
issue_number=$(echo "$line" | awk -F '[/#)]' '{print $3}')
pr_number=$(echo "$line" | sed -n -e 's/.*(#\([^)]*\))$/\1/p')
if [[ -z $pr_number ]] || [[ -z $issue_number ]]
then
continue
fi
echo -e "* **mojaloop/#$issue_number** $description ([mojaloop/#$pr_number](https://github.com/mojaloop/$repository/pull/$pr_number)), closes [mojaloop/#$issue_number](https://github.com/mojaloop/project/issues/$issue_number)"
done
done

echo "$bug_fixes"
}

# Generate "Application Versions" section of the release note
Expand Down

0 comments on commit 38cafb8

Please sign in to comment.