From 56d7e83cec79e47d732e39dc4abeac401a51427d Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 09:22:14 +0300 Subject: [PATCH 01/10] Extract purpose from PR description for release notes in GitHub Actions workflow --- .github/workflows/create-tag-on-merge.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index c18819e1..dedf629b 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -40,6 +40,21 @@ jobs: if (prs?.length > 0) { const pull_number = prs[0].number; const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number }); + + // Extract only the Purpose section from PR description + let releaseNote = 'No description provided'; + if (pr.body) { + const purposeMatch = pr.body.match(/Purpose:\s*(.+?)(?:\n|Main changes:|$)/s); + + if (purposeMatch) { + releaseNote = purposeMatch[1].trim(); + } + } + + core.setOutput('pr-title', pr.title); + core.setOutput('release-note', releaseNote); + core.setOutput('pr-number', pr.number); + return pr.labels.some(label => label.name.includes('auto-deploy')); } return false; @@ -49,6 +64,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release create $NEW_TAG --generate-notes + RELEASE_NOTE="${{ steps.should-deploy.outputs.release-note }}" + + gh release create $NEW_TAG --notes "$RELEASE_NOTE" git checkout $NEW_TAG npm run update-v2-tag From aef6a00ba0293e7e8026d02054e130e4f60e055e Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 09:22:37 +0300 Subject: [PATCH 02/10] Comment out the step to create and push a new tag in the GitHub Actions workflow --- .github/workflows/create-tag-on-merge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index dedf629b..aa4925c9 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -21,8 +21,8 @@ jobs: with: node-version-file: .nvmrc - - name: Create and push new tag - run: npm run create-tag + # - name: Create and push new tag + # run: npm run create-tag - name: Get latest commit id: get-commit From 47e5d9767e85809f89dca97470b199b67c3a5e12 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 08:31:46 +0200 Subject: [PATCH 03/10] Update .github/workflows/create-tag-on-merge.yml Co-authored-by: gitstream-cm[bot] <111687743+gitstream-cm[bot]@users.noreply.github.com> --- .github/workflows/create-tag-on-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index aa4925c9..9f542761 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -44,7 +44,7 @@ jobs: // Extract only the Purpose section from PR description let releaseNote = 'No description provided'; if (pr.body) { - const purposeMatch = pr.body.match(/Purpose:\s*(.+?)(?:\n|Main changes:|$)/s); + const purposeMatch = pr.body.match(/Purpose:\s*([^\n]+)/); if (purposeMatch) { releaseNote = purposeMatch[1].trim(); From 11f4b35e9fdcb31625e94f808ae8a7e7443c591f Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 09:32:03 +0300 Subject: [PATCH 04/10] Fix release notes extraction and update output variable names in GitHub Actions workflow --- .github/workflows/create-tag-on-merge.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index aa4925c9..9017709a 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -42,7 +42,8 @@ jobs: const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number }); // Extract only the Purpose section from PR description - let releaseNote = 'No description provided'; + let releaseNote = pr.title; + if (pr.body) { const purposeMatch = pr.body.match(/Purpose:\s*(.+?)(?:\n|Main changes:|$)/s); @@ -52,7 +53,7 @@ jobs: } core.setOutput('pr-title', pr.title); - core.setOutput('release-note', releaseNote); + core.setOutput('release-notes', releaseNote); core.setOutput('pr-number', pr.number); return pr.labels.some(label => label.name.includes('auto-deploy')); @@ -64,8 +65,19 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - RELEASE_NOTE="${{ steps.should-deploy.outputs.release-note }}" + PR_TITLE="${{ steps.should-deploy.outputs.pr-title }}" + RELEASE_NOTES="${{ steps.should-deploy.outputs.release-notes }}" + PR_NUMBER="${{ steps.should-deploy.outputs.pr-number }}" + + # Create release notes with PR title, description, and link + cat > release_notes.md << EOF + ## ${PR_TITLE} + + ${RELEASE_NOTES} + + **Pull Request:** [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) + EOF - gh release create $NEW_TAG --notes "$RELEASE_NOTE" + gh release create $NEW_TAG --notes-file release_notes.md git checkout $NEW_TAG npm run update-v2-tag From d21f85edc86f4e2d93985e415b302850dc4cc73b Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 09:45:40 +0300 Subject: [PATCH 05/10] Comment out deployment steps in GitHub Actions workflow for debugging --- .github/workflows/create-tag-on-merge.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index bf025680..3a947d5f 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -61,7 +61,7 @@ jobs: return false; - name: Create GitHub Release & Deploy - if: steps.should-deploy.outputs.result == 'true' + # if: steps.should-deploy.outputs.result == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -78,6 +78,7 @@ jobs: **Pull Request:** [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) EOF - gh release create $NEW_TAG --notes-file release_notes.md - git checkout $NEW_TAG - npm run update-v2-tag + cat release_notes.md + # gh release create $NEW_TAG --notes-file release_notes.md + # git checkout $NEW_TAG + # npm run update-v2-tag From ba6ffbcd776ca799cb047966f1bf591011a2fc83 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 10:02:58 +0300 Subject: [PATCH 06/10] Refine release notes extraction to include content between gitstream placeholders and update output format --- .github/workflows/create-tag-on-merge.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index 3a947d5f..10fe567b 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -41,14 +41,14 @@ jobs: const pull_number = prs[0].number; const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number }); - // Extract only the Purpose section from PR description + // Extract content between gitstream placeholders, excluding header and footer let releaseNote = pr.title; if (pr.body) { - const purposeMatch = pr.body.match(/Purpose:\s*([^\n]+)/); + const contentMatch = pr.body.match(/.*?### ✨ PR Description\s*(.*?)\s*_Generated by LinearB AI.*?/s); - if (purposeMatch) { - releaseNote = purposeMatch[1].trim(); + if (contentMatch) { + releaseNote = contentMatch[1].trim(); } } @@ -71,11 +71,10 @@ jobs: # Create release notes with PR title, description, and link cat > release_notes.md << EOF - ## ${PR_TITLE} + ## What's Changed + - ${PR_TITLE} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) ${RELEASE_NOTES} - - **Pull Request:** [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) EOF cat release_notes.md From 9cd1c200ad1c51ebdffacc0782538b563634e3f6 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 10:05:58 +0300 Subject: [PATCH 07/10] Uncomment tag creation and release steps in GitHub Actions workflow --- .github/workflows/create-tag-on-merge.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index 10fe567b..e2f8b468 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -21,8 +21,8 @@ jobs: with: node-version-file: .nvmrc - # - name: Create and push new tag - # run: npm run create-tag + - name: Create and push new tag + run: npm run create-tag - name: Get latest commit id: get-commit @@ -73,11 +73,11 @@ jobs: cat > release_notes.md << EOF ## What's Changed - - ${PR_TITLE} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) + ${PR_TITLE} in [#${PR_NUMBER}](https://github.com/${{ github.repository }}/pull/${PR_NUMBER}) + ${RELEASE_NOTES} EOF - cat release_notes.md - # gh release create $NEW_TAG --notes-file release_notes.md - # git checkout $NEW_TAG - # npm run update-v2-tag + gh release create $NEW_TAG --notes-file release_notes.md + git checkout $NEW_TAG + npm run update-v2-tag From 30d85e37d8776e18833cb9e8b582c89032c97849 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 10:08:53 +0300 Subject: [PATCH 08/10] Uncomment condition for auto-deployment in GitHub Actions workflow --- .github/workflows/create-tag-on-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index e2f8b468..6b033972 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -61,7 +61,7 @@ jobs: return false; - name: Create GitHub Release & Deploy - # if: steps.should-deploy.outputs.result == 'true' + if: steps.should-deploy.outputs.result == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 97bec0139c27fd5e0049aaae0b178be383ac9c2c Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sun, 20 Jul 2025 10:09:28 +0300 Subject: [PATCH 09/10] Add step to update v2-lite branch after creating a new tag --- .github/workflows/create-tag-on-merge.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index 6b033972..5139e38f 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -81,3 +81,14 @@ jobs: gh release create $NEW_TAG --notes-file release_notes.md git checkout $NEW_TAG npm run update-v2-tag + + - name: Update v2-lite + if: steps.should-deploy.outputs.result == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git checkout v2-lite + git checkout $NEW_TAG package.json package-lock.json dist/ + git add package.json package-lock.json dist/ + git commit -m "Update v2-lite to $NEW_TAG" + git push origin v2-lite From 1c07af05ceb94773f2be468ad1d3e295adaad180 Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Tue, 22 Jul 2025 10:00:49 +0300 Subject: [PATCH 10/10] Enhance release notes extraction to prioritize CHANGELOG section and support new format --- .github/workflows/create-tag-on-merge.yml | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-tag-on-merge.yml b/.github/workflows/create-tag-on-merge.yml index 5139e38f..c4925fec 100644 --- a/.github/workflows/create-tag-on-merge.yml +++ b/.github/workflows/create-tag-on-merge.yml @@ -41,14 +41,29 @@ jobs: const pull_number = prs[0].number; const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number }); - // Extract content between gitstream placeholders, excluding header and footer + // Extract content from PR description - prioritize CHANGELOG if present let releaseNote = pr.title; if (pr.body) { - const contentMatch = pr.body.match(/.*?### ✨ PR Description\s*(.*?)\s*_Generated by LinearB AI.*?/s); - - if (contentMatch) { - releaseNote = contentMatch[1].trim(); + // First, check for __CHANGELOG__ section + const changelogMatch = pr.body.match(/__CHANGELOG__\s*(.*?)\s*_Generated by LinearB AI/s); + + if (changelogMatch) { + releaseNote = changelogMatch[1].trim(); + } else { + // Fallback to original gitstream placeholder extraction + const contentMatch = pr.body.match(/.*?### ✨ PR Description\s*(.*?)\s*_Generated by LinearB AI.*?/s); + + if (contentMatch) { + releaseNote = contentMatch[1].trim(); + } else { + // New format without gitstream placeholders + const newFormatMatch = pr.body.match(/## ✨ PR Description\s*(.*?)\s*(?:__CHANGELOG__|_Generated by LinearB AI)/s); + + if (newFormatMatch) { + releaseNote = newFormatMatch[1].trim(); + } + } } }