From 9c24bb42e870e15efcdc836737f5c2089a168c44 Mon Sep 17 00:00:00 2001 From: Anshudhar Kumar Singh Date: Thu, 23 May 2024 00:57:31 +0530 Subject: [PATCH] Fix sed grouping in changelog action --- .github/workflows/changelog.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 2609dba..2e7fd25 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -50,13 +50,14 @@ jobs: fi # Regular expression to match version numbers - if [ -z "$(grep -E "^## [0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?" packages/$package/CHANGELOG.md)" ]; then + version_line=$(grep -E "^## [0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?" packages/$package/CHANGELOG.md | head -n 1) + if [ -z "$version_line" ]; then errors+=("Error: No version bump found in packages/$package/CHANGELOG.md") continue fi # Extracting the version number from the changelog entry - current_version=$(grep -E "^## ([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)" packages/$package/CHANGELOG.md | head -n 1 | sed -E "s/^## ([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?) .*/\1/") + current_version=$(echo "$version_line" | sed -E "s/^## ([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?).*$/\1/") # Parsing the version number from the package.json package_version=$(cat packages/$package/package.json | jq -r .version)