From c8a4725c3c4cb6fbcd1b77a48cf0426614412a45 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:51:20 -0600 Subject: [PATCH 1/5] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 233da07..d083b00 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -99,7 +99,7 @@ jobs: git config user.name "github-actions[bot]" # place the entry within the correct header - input_string='${{ needs.changelog-entry.outputs.entry }}' + input_string=${{ needs.changelog-entry.outputs.entry }} changelog_file="CHANGELOG.md" # Extract the type (e.g., BUG or ENHANCEMENT) from the input string @@ -124,7 +124,7 @@ jobs: #input_string=$(echo $input_string | sed -e 's/^\[BUG\] //' -e 's/^\[ENHANCEMENT\] //' -e 's/^\[FEATURE\] //' -e 's/^\[BREAKING\] //') # Find the header and insert the input string under the first occurrence - awk -v header=$header -v input_string=$input_string ' + awk -v header="$header" -v input_string="$input_string" ' BEGIN { found_header = 0 } From 479cc629e2141d2e752ac180c17e3aba4066ad97 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:04:49 -0600 Subject: [PATCH 2/5] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 52 ++++----------------------- 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index d083b00..dbfe03f 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -90,6 +90,12 @@ jobs: -l "changelog" \ -t "CHANGELOG.md updates" \ -b "changelog for next release" + + - name: Set up Python + uses: actions/setup-python@v4 # Set up Python environment + with: + python-version: '3.9' + - name: Add commit message to changelog pull request # at this point a PR is opened for sure, now add entry env: @@ -98,52 +104,8 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - # place the entry within the correct header - input_string=${{ needs.changelog-entry.outputs.entry }} - changelog_file="CHANGELOG.md" - - # Extract the type (e.g., BUG or ENHANCEMENT) from the input string - if [[ $input_string =~ ^\[(BUG|ENHANCEMENT|FEATURE|BREAKING)\] ]]; then - change_type="${BASH_REMATCH[1]}" - else - echo "Invalid input string format. Expected '[BUG]' or '[ENHANCEMENT]' or '[FEATURE]' or '[BREAKING]'." - exit 1 - fi - - # Define the header based on the change type - if [[ "$change_type" == "BUG" ]]; then - header="BUG FIXES:" - elif [[ "$change_type" == "ENHANCEMENT" ]]; then - header="ENHANCEMENTS:" - elif [[ "$change_type" == "FEATURE" ]]; then - header="FEATURES:" - elif [[ "$change_type" == "BREAKING" ]]; then - header="BREAKING CHANGES:" - fi - - #input_string=$(echo $input_string | sed -e 's/^\[BUG\] //' -e 's/^\[ENHANCEMENT\] //' -e 's/^\[FEATURE\] //' -e 's/^\[BREAKING\] //') - - # Find the header and insert the input string under the first occurrence - awk -v header="$header" -v input_string="$input_string" ' - BEGIN { - found_header = 0 - } + python update_changelog.py ${{ needs.changelog-entry.outputs.entry }} - # Look for the first occurrence of the header - $0 ~ header && found_header == 0 { - found_header = 1 - print $0 - print input_string - next - } - - # After inserting the input_string, continue printing the rest of the file normally - { print $0 } - ' $changelog_file > "${changelog_file}.tmp" - mv "${changelog_file}.tmp" $changelog_file - - echo "The change has been added to the changelog under the first occurrence of $header." - git add CHANGELOG.md git commit -m "Update changelog" git push --set-upstream origin automated-changelog From 6ffc213cd30be5ab806baeec6609f3b539a85b47 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:08:06 -0600 Subject: [PATCH 3/5] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index dbfe03f..37869c0 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -104,7 +104,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - python update_changelog.py ${{ needs.changelog-entry.outputs.entry }} + python .github/workflows/update_changelog.py "${{ needs.changelog-entry.outputs.entry }}" git add CHANGELOG.md git commit -m "Update changelog" From ebc6d209ed2966b9ffc891b477abcdb5dd2377cc Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:27:08 -0600 Subject: [PATCH 4/5] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 37869c0..43f0299 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -104,7 +104,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - python .github/workflows/update_changelog.py "${{ needs.changelog-entry.outputs.entry }}" + python update_changelog.py "${{ needs.changelog-entry.outputs.entry }}" git add CHANGELOG.md git commit -m "Update changelog" From 25b0d08550e1c35a3e00dd6403f0bc837fe177bd Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:34:18 -0600 Subject: [PATCH 5/5] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 43f0299..cac8012 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -104,7 +104,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - python update_changelog.py "${{ needs.changelog-entry.outputs.entry }}" + python update_changelog.py '${{ needs.changelog-entry.outputs.entry }}' git add CHANGELOG.md git commit -m "Update changelog"