From 2411db4d82d9c9a047f7f758e79e012704a07ad1 Mon Sep 17 00:00:00 2001 From: godcong Date: Fri, 29 Nov 2024 02:46:32 +0800 Subject: [PATCH 1/2] ci(release): optimize changelog generation in release workflow - Remove unnecessary conditional check for "null" in contrib module - Comment out unused CHANGELOG variable assignment in runtime and root workflows - Improve code readability and reduce redundancy across all workflows --- .github/workflows/release_and_tagging.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_and_tagging.yml b/.github/workflows/release_and_tagging.yml index d70b010..de4b2c4 100644 --- a/.github/workflows/release_and_tagging.yml +++ b/.github/workflows/release_and_tagging.yml @@ -60,17 +60,16 @@ jobs: id: generate_changelog run: | LATEST_RELEASE=${{ steps.get_latest_release.outputs.LATEST_RELEASE }} - echo "LATEST_RELEASE is $LATEST_RELEASE" echo "# Changelog" > changelog.txt - if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then - # If there's no previous release, get only the current commit log + if [[ -z "$LATEST_RELEASE" ]]; then + # If there's no previous release, get only the current commit's log git config --global core.pager cat # git log --pretty=format:"* %s **by** @%an" git log --pretty=format:"* %s **by** @%an" >> changelog.txt else # Get all submission information since the last release - CHANGELOG=$(git log "$LATEST_RELEASE"..HEAD -- --pretty=format:"* %s **by** @%an") - git log "$LATEST_RELEASE"..HEAD -- --pretty=format:"* %s **by** @%an" >> changelog.txt + CHANGELOG=$(git log "$LATEST_RELEASE"..HEAD --pretty=format:"* %s **by** @%an") + git log "$LATEST_RELEASE"..HEAD --pretty=format:"* %s **by** @%an" >> changelog.txt fi - name: Create release From 1462e51f3248f57203589760eb01e79495c06008 Mon Sep 17 00:00:00 2001 From: godcong Date: Fri, 29 Nov 2024 02:50:30 +0800 Subject: [PATCH 2/2] ci(release): improve null check for latest release in changelog generation - Enhance the condition to check if $LATEST_RELEASE is empty or null - This change ensures the changelog generation step handles cases where no previous release exists --- .github/workflows/release_and_tagging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_and_tagging.yml b/.github/workflows/release_and_tagging.yml index de4b2c4..75a64eb 100644 --- a/.github/workflows/release_and_tagging.yml +++ b/.github/workflows/release_and_tagging.yml @@ -61,7 +61,7 @@ jobs: run: | LATEST_RELEASE=${{ steps.get_latest_release.outputs.LATEST_RELEASE }} echo "# Changelog" > changelog.txt - if [[ -z "$LATEST_RELEASE" ]]; then + if [[ -z "$LATEST_RELEASE" || "$LATEST_RELEASE" == "null" ]]; then # If there's no previous release, get only the current commit's log git config --global core.pager cat # git log --pretty=format:"* %s **by** @%an"