Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge.turrado@scrm.lidl>
  • Loading branch information
JorTurFer committed Aug 17, 2023
1 parent b3eb5de commit 2739bb1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions hack/validate-changelog.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

Expand Down Expand Up @@ -26,10 +26,10 @@ function extract_and_check() {
fi

# Separate and sort the **General**: lines
local sorted_general_lines=$(echo "$content" | grep '^- \*\*General\*\*:' | sort --ignore-case)

local sorted_general_lines=$(echo "$content" | grep '^- \*\*General\*\*:' | sort --ignore-case --dictionary-order)
# Sort the remaining lines
local sorted_content=$(echo "$content" | grep -v '^- \*\*General\*\*:' | sort --ignore-case)
local sorted_content=$(echo "$content" | grep -v '^- \*\*General\*\*:' | sort --ignore-case --dictionary-order)

# Check if sorted_general_lines is not empty, then concatenate
if [[ -n "$sorted_general_lines" ]]; then
Expand All @@ -40,7 +40,7 @@ function extract_and_check() {
while IFS= read -r line; do
echo "Error: Wrong pattern found in section: $section , line: $line"
exit 1
done < <(grep -Pv '^(-\s\*\*[^*]+\*\*: .*\(\[#(\d+)\]\(https:\/\/github\.com\/kedacore\/(keda|charts|governance)\/(pull|issues|discussions)\/\2\)(?:\|\[#(\d+)\]\(https:\/\/github\.com\/kedacore\/(keda|charts|governance)\/(pull|issues|discussions)\/\5\)){0,}\))$' <<< "$content")
done < <(grep -Ev '^(-\s\*\*[^*]+\*\*: .*\(\[#(\d+)\]\(https:\/\/github\.com\/kedacore\/(keda|charts|governance)\/(pull|issues|discussions)\/\2\)(?:\|\[#(\d+)\]\(https:\/\/github\.com\/kedacore\/(keda|charts|governance)\/(pull|issues|discussions)\/\5\)){0,}\))$' <<< "$content")

if [ "$content" != "$sorted_content" ]; then
echo "Error: Section: $section is not sorted correctly. Correct order:"
Expand Down

0 comments on commit 2739bb1

Please sign in to comment.