Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
Augustinio committed Oct 7, 2024
1 parent 15b9336 commit 1f1aab5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/publish-to-testpypi-and-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
version=${{ env.VERSION }}
# Extract notes from changelog
notes=$(awk -v ver="$version" '
BEGIN { found_version=0; output_started=0; }
BEGIN { found_version=0; leading_blank=1; }
/## \[/ { if (found_version) { exit } }
/## \['"$version"'\]/ {
found_version=1;
Expand All @@ -71,18 +71,15 @@ jobs:
# Remove the _released line
if ($0 ~ /^_released/) { next }
# Remove leading ### and any additional whitespace
gsub(/^### +/, "", $0);
# Remove leading ### or ## or # and any additional whitespace
gsub(/^#+ +/, "", $0);
# Print lines, ensuring the first one does not have leading newlines
# Check if the line is blank
if ($0 != "") {
if (output_started) {
print $0; # Print subsequent lines normally
} else {
print $0; # Print the first non-empty line
output_started=1; # Set the flag after printing the first line
print ""; # Print a blank line after the first output
}
print $0; # Print the current line
leading_blank=0; # Reset leading blank flag
} else if (!leading_blank) {
print ""; # Print a blank line for subsequent empty lines
}
}
' CHANGELOG.md)
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/test_release_notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
version=${{ env.VERSION }}
# Extract notes from changelog
notes=$(awk -v ver="$version" '
BEGIN { found_version=0; output_started=0; }
BEGIN { found_version=0; leading_blank=1; }
/## \[/ { if (found_version) { exit } }
/## \['"$version"'\]/ {
found_version=1;
Expand All @@ -32,18 +32,15 @@ jobs:
# Remove the _released line
if ($0 ~ /^_released/) { next }
# Remove leading ### and any additional whitespace
gsub(/^### +/, "", $0);
# Remove leading ### or ## or # and any additional whitespace
gsub(/^#+ +/, "", $0);
# Print lines, ensuring the first one does not have leading newlines
# Check if the line is blank
if ($0 != "") {
if (output_started) {
print $0; # Print subsequent lines normally
} else {
print $0; # Print the first non-empty line
output_started=1; # Set the flag after printing the first line
print ""; # Print a blank line after the first output
}
print $0; # Print the current line
leading_blank=0; # Reset leading blank flag
} else if (!leading_blank) {
print ""; # Print a blank line for subsequent empty lines
}
}
' CHANGELOG.md)
Expand Down

0 comments on commit 1f1aab5

Please sign in to comment.