From 7be01cac091b4425819a1f4488a956523cf2a86e Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:29:29 -0600 Subject: [PATCH 01/33] checking for open PR --- .github/workflows/updateChangelog.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 11574be..9abdbde 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -37,5 +37,22 @@ jobs: runs-on: ubuntu-latest needs: changelog-entry steps: - - name: check for a changelog PR, if no PR, open one, append entry to PR - run: echo "opted in is true, check for PR" + - name: Check if PR exists + id: check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ + --json title \ + --jq '.[] | select(.title|test("^a.")) | .number') + if ((prs)); then + echo "skip=true" >> "$GITHUB_OUTPUT" + fi + - name: Create pull request + if: '!steps.check.outputs.skip' + run: echo "Creating a new pull request - debug" + # if changelog PR isn't already open, open one + #run: | + #gh pr create -B targetBranch -H source Branch + From 1d03162bd762f09fc050d7d6106d89a9b0592a60 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:30:33 -0600 Subject: [PATCH 02/33] 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 9abdbde..a592d76 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -45,7 +45,7 @@ jobs: prs=$(gh pr list \ --repo "$GITHUB_REPOSITORY" \ --json title \ - --jq '.[] | select(.title|test("^a.")) | .number') + --jq '.[] | select(.title|test("^abc.")) | .number') if ((prs)); then echo "skip=true" >> "$GITHUB_OUTPUT" fi From c1eafe5d3e9ac30c90c342f2a775696e72d2b729 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:49:42 -0600 Subject: [PATCH 03/33] 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 a592d76..355a803 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -45,7 +45,7 @@ jobs: prs=$(gh pr list \ --repo "$GITHUB_REPOSITORY" \ --json title \ - --jq '.[] | select(.title|test("^abc.")) | .number') + --jq '.[] | select(.title|test("xyz."))') if ((prs)); then echo "skip=true" >> "$GITHUB_OUTPUT" fi From 3101c80f33c1fc701a7a542f3e5840c299f7026b Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:18:28 -0600 Subject: [PATCH 04/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 355a803..dbdb741 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -42,13 +42,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - prs=$(gh pr list \ - --repo "$GITHUB_REPOSITORY" \ - --json title \ - --jq '.[] | select(.title|test("xyz."))') - if ((prs)); then - echo "skip=true" >> "$GITHUB_OUTPUT" - fi + echo "gh pr list --repo "$GITHUB_REPOSITORY" --json title" + #prs=$(gh pr list \ + #--repo "$GITHUB_REPOSITORY" \ + #--json title \ + #--jq '.[] | select(.title|test("xyz."))') + #if ((prs)); then + #echo "skip=true" >> "$GITHUB_OUTPUT" + #fi - name: Create pull request if: '!steps.check.outputs.skip' run: echo "Creating a new pull request - debug" From 79ba3074c9cbead0351be3c55c5fa1d02b644073 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:14:56 -0600 Subject: [PATCH 05/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index dbdb741..9deca7a 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -40,13 +40,12 @@ jobs: - name: Check if PR exists id: check env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "gh pr list --repo "$GITHUB_REPOSITORY" --json title" + echo "gh pr list --json title" #prs=$(gh pr list \ - #--repo "$GITHUB_REPOSITORY" \ #--json title \ - #--jq '.[] | select(.title|test("xyz."))') + #--jq '.[].title | select(test("xyz"))') #if ((prs)); then #echo "skip=true" >> "$GITHUB_OUTPUT" #fi From 60a492ef96ab1ff736ce630bf13fc464e622793e Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:19:16 -0600 Subject: [PATCH 06/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index b6b9144..68fd9a9 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -44,6 +44,7 @@ jobs: run: | echo "gh pr list --json title" prs=$(gh pr list \ + --repo "$GITHUB_REPOSITORY" \ --json title \ --jq '.[].title | select(test("xyz"))') if ((prs)); then From 932fb96e218655c8410f068891f4f19820f676c3 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:40:09 -0600 Subject: [PATCH 07/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 68fd9a9..c534f02 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -42,16 +42,16 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "gh pr list --json title" prs=$(gh pr list \ --repo "$GITHUB_REPOSITORY" \ --json title \ - --jq '.[].title | select(test("xyz"))') - if ((prs)); then - echo "skip=true" >> "$GITHUB_OUTPUT" + --label "changelog" \ + --jq 'length') + if ((prs > 0)); then + echo "existing=true" >> "$GITHUB_OUTPUT" fi - name: Create pull request - if: '!steps.check.outputs.skip' + if: '!steps.check.outputs.existing' run: echo "Creating a new pull request - debug" # if changelog PR isn't already open, open one #run: | From 10c02acad306be89cc6e6512be92d807bb0e4dc8 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:46:56 -0600 Subject: [PATCH 08/33] 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 c534f02..ef16c78 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -47,7 +47,7 @@ jobs: --json title \ --label "changelog" \ --jq 'length') - if ((prs > 0)); then + if (($prs > 0)); then echo "existing=true" >> "$GITHUB_OUTPUT" fi - name: Create pull request From e1b8b0dcd9b9c4d3b55e5016731db0e04bce7a98 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:48:13 -0600 Subject: [PATCH 09/33] 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 ef16c78..8fe3e7d 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -47,7 +47,7 @@ jobs: --json title \ --label "changelog" \ --jq 'length') - if (($prs > 0)); then + if [[ $prs -gt 0 ]]; then echo "existing=true" >> "$GITHUB_OUTPUT" fi - name: Create pull request From 1aebdb85f8e9ce81e0c18a55ee5d048b19cb6810 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:30:03 -0600 Subject: [PATCH 10/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 8fe3e7d..5d04a9e 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -56,4 +56,5 @@ jobs: # if changelog PR isn't already open, open one #run: | #gh pr create -B targetBranch -H source Branch - + - name: Add commit message to changelog pull request + # at this point a PR is opened for sure, now add entry From 911cb3b584f39ded1a85987b89640910e38d38f1 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:57:30 -0600 Subject: [PATCH 11/33] Update updateChangelog.yml testing getting message in changelog add job --- .github/workflows/updateChangelog.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 5d04a9e..e625493 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -50,11 +50,28 @@ jobs: if [[ $prs -gt 0 ]]; then echo "existing=true" >> "$GITHUB_OUTPUT" fi + - uses: actions/checkout@v4 - name: Create pull request + #if changelog PR isn't already open, open one + #create a new PR, start with appending the release number and (unreleased) if: '!steps.check.outputs.existing' - run: echo "Creating a new pull request - debug" - # if changelog PR isn't already open, open one - #run: | - #gh pr create -B targetBranch -H source Branch + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git checkout -b automated-changelog + echo -e "${{ needs.changelog-entry.pull-commit-message.outputs.message }}\n" >> CHANGELOG.md + echo "Creating a new pull request" + gh pr create \ + --repo "$GITHUB_REPOSITORY" \ + --base main \ + --head automated-changelog \ + -l "changelog" \ + -t Changelog - name: Add commit message to changelog pull request # at this point a PR is opened for sure, now add entry + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "${{ needs.changelog-entry.pull-commit-message.outputs.message }}" + #git checkout -b automated-changelog + From 7749095a885527ad706b265fd104703ea26a905d Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:18:07 -0600 Subject: [PATCH 12/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 80b9578..4c55d69 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -27,6 +27,7 @@ jobs: needs: pull-commit-message outputs: optIn: ${{ steps.in.outputs.bool }} + entry: ${{ needs.pull-commit-message.outputs.message }} steps: - name: changelog entry opt in id: in @@ -72,7 +73,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "${{ needs.changelog-entry.pull-commit-message.outputs.message }}" + echo "${{ needs.changelog-entry.outputs.entry }}" #git checkout -b automated-changelog From d34e356740b828d0bdf20621796496bb029016e8 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:05:22 -0600 Subject: [PATCH 13/33] Update updateChangelog.yml PR is already open, append commit message changelog entry --- .github/workflows/updateChangelog.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 4c55d69..bd23226 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -60,7 +60,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git checkout -b automated-changelog - echo -e "${{ needs.changelog-entry.pull-commit-message.outputs.message }}\n" >> CHANGELOG.md + echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md echo "Creating a new pull request" gh pr create \ --repo "$GITHUB_REPOSITORY" \ @@ -73,7 +73,12 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "${{ needs.changelog-entry.outputs.entry }}" - #git checkout -b automated-changelog + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + git checkout -b automated-changelog + echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md + git add CHANGELOG.md + git commit -m "Update CHANGELOG.md with ${{ needs.changelog-entry.outputs.entry }}" + git push From bace31e8d2b50a04bde89bf75bd957f3fc45317b Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:46:12 -0600 Subject: [PATCH 14/33] 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 019ba16..f114228 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -79,5 +79,5 @@ jobs: echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md git add CHANGELOG.md git commit -m "Update CHANGELOG.md with ${{ needs.changelog-entry.outputs.entry }}" - git push + git push --set-upstream origin automated-changelog From 5f7ac901e06c9278687175786a6014b490c73d79 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:58:25 -0600 Subject: [PATCH 15/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index f114228..91e85b5 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -2,6 +2,7 @@ name: Update Changelog with new commit permissions: pull-requests: write + contents: write on: pull_request: From 961bee7f8fd86072633c2067537e4b1bf3ab262d Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:02:58 -0600 Subject: [PATCH 16/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 91e85b5..30ac77f 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -77,6 +77,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" git checkout -b automated-changelog + git pull echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md git add CHANGELOG.md git commit -m "Update CHANGELOG.md with ${{ needs.changelog-entry.outputs.entry }}" From 241195fe34222b929d6d7994e6debaecd36df671 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:06:19 -0600 Subject: [PATCH 17/33] 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 30ac77f..4e62cf0 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -77,7 +77,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" git checkout -b automated-changelog - git pull + git pull origin/automated-changelog echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md git add CHANGELOG.md git commit -m "Update CHANGELOG.md with ${{ needs.changelog-entry.outputs.entry }}" From 1f01b022b6ffca78fc466283b8ea6cd13a73c7af Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:14:57 -0600 Subject: [PATCH 18/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 4e62cf0..d314d2a 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -53,6 +53,8 @@ jobs: echo "existing=true" >> "$GITHUB_OUTPUT" fi - uses: actions/checkout@v4 + with: + ref: automated-changelog - name: Create pull request #if changelog PR isn't already open, open one #create a new PR, start with appending the release number and (unreleased) @@ -76,10 +78,8 @@ jobs: run: | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - git checkout -b automated-changelog - git pull origin/automated-changelog echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md git add CHANGELOG.md - git commit -m "Update CHANGELOG.md with ${{ needs.changelog-entry.outputs.entry }}" + git commit -m "Update CHANGELOG.md -m "${{ needs.changelog-entry.outputs.entry }}" git push --set-upstream origin automated-changelog From e6f94d05b8daccd840f5ad244da8c5a7e911209a Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:17:07 -0600 Subject: [PATCH 19/33] 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 d314d2a..71d535a 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -80,6 +80,6 @@ jobs: git config user.name "github-actions[bot]" echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md git add CHANGELOG.md - git commit -m "Update CHANGELOG.md -m "${{ needs.changelog-entry.outputs.entry }}" + git commit -m "Update CHANGELOG.md" -m "${{ needs.changelog-entry.outputs.entry }}" git push --set-upstream origin automated-changelog From 89011af604bf13ecb425c2ff3ec7c50fc2cc894d Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:46:29 -0600 Subject: [PATCH 20/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 71d535a..0f62cb0 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -62,8 +62,13 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git checkout -b automated-changelog - echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + #new pull request for new release needs the headers all added to the top + echo -e "date (unreleased) header, Bug, Enhancement, Breaking Change, Features headers" >> CHANGELOG.md + git add CHANGELOG.md + git commit -m "Update CHANGELOG.md" -m "${{ needs.changelog-entry.outputs.entry }}" + git push --set-upstream origin automated-changelog echo "Creating a new pull request" gh pr create \ --repo "$GITHUB_REPOSITORY" \ @@ -78,7 +83,24 @@ jobs: run: | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - echo -e "${{ needs.changelog-entry.outputs.entry }}\n" >> CHANGELOG.md + + # place the entry within the correct header + header=$(echo ${{ needs.changelog-entry.outputs.entry }} | sed -n 's/\[\(.*\)\].*/\1/p')) + case $header in + BUG) + sed -i "0,^BUG FIXES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + ;; + ENHANCEMENT) + sed -i "0,^ENHANCEMENTS:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + ;; + BREAKING) + sed -i "0,^BREAKING CHANGES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + ;; + FEATURE) + sed -i "0,^FEATURES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + ;; + esac + git add CHANGELOG.md git commit -m "Update CHANGELOG.md" -m "${{ needs.changelog-entry.outputs.entry }}" git push --set-upstream origin automated-changelog From a1a517cb03c5ebfd047cce310e8e0c8c1c0c2c3f Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:50:51 -0600 Subject: [PATCH 21/33] 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 0f62cb0..70290ce 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -85,7 +85,7 @@ jobs: git config user.name "github-actions[bot]" # place the entry within the correct header - header=$(echo ${{ needs.changelog-entry.outputs.entry }} | sed -n 's/\[\(.*\)\].*/\1/p')) + header=$(echo ${{ needs.changelog-entry.outputs.entry }} | sed -n 's/\[\(.*\)\].*/\1/p') case $header in BUG) sed -i "0,^BUG FIXES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md From 6dc5a2d668bd5e3a9d44c6b79a18c07c6816676a Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:57:33 -0600 Subject: [PATCH 22/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 820f090..0b3f2be 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -85,20 +85,20 @@ jobs: git config user.name "github-actions[bot]" # place the entry within the correct header - header=$(echo ${{ needs.changelog-entry.outputs.entry }} | sed -n 's/\[\(.*\)\].*/\1/p') + header=$(echo "${{ needs.changelog-entry.outputs.entry }}" | sed -n 's/\[\(.*\)\].*/\1/p') case $header in BUG) - sed -i "0,^BUG FIXES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + sed -i '0,^BUG FIXES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md ;; ENHANCEMENT) - sed -i "0,^ENHANCEMENTS:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + sed -i '0,^ENHANCEMENTS:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md ;; BREAKING) - sed -i "0,^BREAKING CHANGES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + sed -i '0,^BREAKING CHANGES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md ;; FEATURE) - sed -i "0,^FEATURES:$/a\${{ needs.changelog-entry.outputs.entry }}" CHANGELOG.md + sed -i '0,^FEATURES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md ;; esac From a58e6bf298dfcfca2e9af26d5eec452604c1b60f Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Mon, 9 Dec 2024 15:04:47 -0600 Subject: [PATCH 23/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 0b3f2be..2f5c206 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -75,7 +75,8 @@ jobs: --base main \ --head automated-changelog \ -l "changelog" \ - -t Changelog + -t "CHANGELOG.md updates" \ + -b "changelog for next release" - name: Add commit message to changelog pull request # at this point a PR is opened for sure, now add entry env: From b88f7ad2f16db39da92d2d7c015eb730e86db103 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:28:50 -0600 Subject: [PATCH 24/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 2f5c206..9cf17d3 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -90,16 +90,16 @@ jobs: case $header in BUG) - sed -i '0,^BUG FIXES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md + awk '/^BUG FIXES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md ;; ENHANCEMENT) - sed -i '0,^ENHANCEMENTS:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md + awk '/^ENHANCEMENTS:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md ;; BREAKING) - sed -i '0,^BREAKING CHANGES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md + awk '/^BREAKING CHANGES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md ;; FEATURE) - sed -i '0,^FEATURES:$/a\${{ needs.changelog-entry.outputs.entry }}' CHANGELOG.md + awk '/^FEATURES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md ;; esac From 0dc3f0ed35b779285bdd8b1e009d8bc5b9953547 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:46:22 -0600 Subject: [PATCH 25/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 9cf17d3..c7f7de8 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -64,8 +64,20 @@ jobs: run: | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" + #new pull request for new release needs the headers all added to the top - echo -e "date (unreleased) header, Bug, Enhancement, Breaking Change, Features headers" >> CHANGELOG.md + FILE="CHANGELOGmd" + version=$(head -n 1 "$FILE") + IFS='.' read -r major minor patch <<< "$version" + ((minor++)) + new_version="${major}.$minor.${patch} (Unreleased)" + headers="## ${new_version}\n\n## BREAKING CHANGES\n\n## ENHANCEMENT\n\n## FEATURES\n\n## BUG FIXES\n" + temp_file=$(mktemp) + echo -e "$headers" > "$temp_file" + cat "$FILE" >> "$temp_file" + mv "$temp_file" "$FILE" + echo "File has been updated." + git add CHANGELOG.md git commit -m "Update CHANGELOG.md" -m "${{ needs.changelog-entry.outputs.entry }}" git push --set-upstream origin automated-changelog From c08c350bf7d0dc0d64f84e3444e8895e3ad6063f Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:48:39 -0600 Subject: [PATCH 26/33] 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 c7f7de8..9268969 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -66,7 +66,7 @@ jobs: git config user.name "github-actions[bot]" #new pull request for new release needs the headers all added to the top - FILE="CHANGELOGmd" + FILE="CHANGELOG.md" version=$(head -n 1 "$FILE") IFS='.' read -r major minor patch <<< "$version" ((minor++)) From 216f46be69e31a1f910d675406bd4e27f930c840 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:56:41 -0600 Subject: [PATCH 27/33] 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 9268969..f624c48 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -71,7 +71,7 @@ jobs: IFS='.' read -r major minor patch <<< "$version" ((minor++)) new_version="${major}.$minor.${patch} (Unreleased)" - headers="## ${new_version}\n\n## BREAKING CHANGES\n\n## ENHANCEMENT\n\n## FEATURES\n\n## BUG FIXES\n" + headers="${new_version}\n\nBREAKING CHANGES:\n\nENHANCEMENT:\n\nFEATURES:\n\nBUG FIXES:\n" temp_file=$(mktemp) echo -e "$headers" > "$temp_file" cat "$FILE" >> "$temp_file" From d01bf535932f58b06904c8eb23ac8f8a7cda6c4f Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:25:59 -0600 Subject: [PATCH 28/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index f624c48..838f851 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -68,8 +68,9 @@ jobs: #new pull request for new release needs the headers all added to the top FILE="CHANGELOG.md" version=$(head -n 1 "$FILE") - IFS='.' read -r major minor patch <<< "$version" + IFS='.' read major minor patch <<< "$version" ((minor++)) + patch=$(echo patch | sed 's/ (.*)//') new_version="${major}.$minor.${patch} (Unreleased)" headers="${new_version}\n\nBREAKING CHANGES:\n\nENHANCEMENT:\n\nFEATURES:\n\nBUG FIXES:\n" temp_file=$(mktemp) From 91aad69ee88013a801f846a25bdd521a2beff745 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:31:19 -0600 Subject: [PATCH 29/33] 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 838f851..7039c78 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -70,7 +70,7 @@ jobs: version=$(head -n 1 "$FILE") IFS='.' read major minor patch <<< "$version" ((minor++)) - patch=$(echo patch | sed 's/ (.*)//') + patch=$(echo $patch | sed 's/ (.*)//') new_version="${major}.$minor.${patch} (Unreleased)" headers="${new_version}\n\nBREAKING CHANGES:\n\nENHANCEMENT:\n\nFEATURES:\n\nBUG FIXES:\n" temp_file=$(mktemp) From 993c2aecee90a4f480f9b87909c97bda10e0a0fd Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:53:39 -0600 Subject: [PATCH 30/33] Update updateChangelog.yml --- .github/workflows/updateChangelog.yml | 57 +++++++++++++++++++-------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/.github/workflows/updateChangelog.yml b/.github/workflows/updateChangelog.yml index 7039c78..546301d 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -99,23 +99,48 @@ jobs: git config user.name "github-actions[bot]" # place the entry within the correct header - header=$(echo "${{ needs.changelog-entry.outputs.entry }}" | sed -n 's/\[\(.*\)\].*/\1/p') - - case $header in - BUG) - awk '/^BUG FIXES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md - ;; - ENHANCEMENT) - awk '/^ENHANCEMENTS:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md - ;; - BREAKING) - awk '/^BREAKING CHANGES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md - ;; - FEATURE) - awk '/^FEATURES:$/ && !f {print; print "${{ needs.changelog-entry.outputs.entry }}"; f=1} 1' CHANGELOG.md - ;; - esac + 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 + # 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 + } + + # 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.md" -m "${{ needs.changelog-entry.outputs.entry }}" git push --set-upstream origin automated-changelog From e0fcc54b77423d7ac8f592d56b8c7b4edbb3b8a5 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:57:45 -0600 Subject: [PATCH 31/33] 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 546301d..0813c86 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -142,6 +142,6 @@ jobs: echo "The change has been added to the changelog under the first occurrence of $header." git add CHANGELOG.md - git commit -m "Update CHANGELOG.md" -m "${{ needs.changelog-entry.outputs.entry }}" + git commit -m "Update CHANGELOG.md" -m "new entry added" git push --set-upstream origin automated-changelog From fb39089719c23230d093af50acdfce19f0d60ad5 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:01:08 -0600 Subject: [PATCH 32/33] 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 0813c86..11c60b9 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -142,6 +142,6 @@ jobs: echo "The change has been added to the changelog under the first occurrence of $header." git add CHANGELOG.md - git commit -m "Update CHANGELOG.md" -m "new entry added" + git commit -m "Update changelog" -m "new entry added" git push --set-upstream origin automated-changelog From f1dafdc3f14721f33b66bfd0b84452d34337dd49 Mon Sep 17 00:00:00 2001 From: Renae Kosir <132920294+rcskosir@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:14:11 -0600 Subject: [PATCH 33/33] 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 11c60b9..9b43f8b 100644 --- a/.github/workflows/updateChangelog.yml +++ b/.github/workflows/updateChangelog.yml @@ -142,6 +142,6 @@ jobs: echo "The change has been added to the changelog under the first occurrence of $header." git add CHANGELOG.md - git commit -m "Update changelog" -m "new entry added" + git commit -m 'Update CHANGELOG.md' -m '${{ needs.changelog-entry.outputs.entry }}' git push --set-upstream origin automated-changelog