From 060e76568ea4052d648f8dc7c16c9003820521b5 Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Wed, 22 May 2024 11:48:10 +0530 Subject: [PATCH 1/6] [Release Notes] Escape markdown special characters --- scripts/github-action/create-github-release.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/github-action/create-github-release.js b/scripts/github-action/create-github-release.js index db1503253c..5086759ef4 100644 --- a/scripts/github-action/create-github-release.js +++ b/scripts/github-action/create-github-release.js @@ -200,7 +200,7 @@ function formatChangeLog(prs, tagsContext, context) { const changelog = ` # What's New - + https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${releaseDiff} ## Packages Published @@ -208,7 +208,7 @@ function formatChangeLog(prs, tagsContext, context) { ${formattedPackageTags || 'No packages published'} ${internalPRS.length > 0 ? formatTable(internalPRS, tableConfig, '## Internal PRs') : ''} - + ${externalPRs.length > 0 ? formatTable(externalPRs, tableConfig, '## External PRs') : ''} ` // trim double spaces and return the changelog @@ -222,10 +222,14 @@ function formatTable(prs, tableConfig, title = '') { |${tableConfig.map((config) => config.label).join('|')}| |${tableConfig.map(() => '---').join('|')}| - ${prs.map((pr) => `|${tableConfig.map((config) => pr[config.value]).join('|')}|`).join('\n')} + ${prs.map((pr) => `|${tableConfig.map((config) => formatValue(pr[config.value])).join('|')}|`).join('\n')} ` } +function formatValue(string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') +} + // Map PRs with affected destinations based on the files changed function mapPRWithAffectedDestinations(pr) { let affectedDestinations = [] From 97819cf15f4b9edce6cd2def6d06c8c3918d5a9a Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:37:31 +0530 Subject: [PATCH 2/6] Bump checkout and setup node to v4 --- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/ext.yml | 4 ++-- .github/workflows/publish.yml | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7cda9abd8..47dc9747c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,13 +17,13 @@ jobs: steps: # See nx recipe: https://nx.dev/recipes/ci/monorepo-ci-github-actions - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 0 # nx recipe - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' @@ -54,13 +54,13 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 0 # nx recipe - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' @@ -93,13 +93,13 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false fetch-depth: 0 # nx recipe - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' @@ -145,12 +145,12 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: persist-credentials: false - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/ext.yml b/.github/workflows/ext.yml index db7cf5dfb7..df88550203 100644 --- a/.github/workflows/ext.yml +++ b/.github/workflows/ext.yml @@ -17,8 +17,8 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: yarn diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 263d604f41..7bf5d7ddc1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,12 +23,12 @@ jobs: node-version: [18.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.GH_PAT }} - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' @@ -63,7 +63,7 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for computing changelog fetch-tags: true From ed3218111073293d6485d8ec59da15f500310705 Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:01:22 +0530 Subject: [PATCH 3/6] add some comments --- scripts/github-action/create-github-release.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/github-action/create-github-release.js b/scripts/github-action/create-github-release.js index 5086759ef4..bec436856a 100644 --- a/scripts/github-action/create-github-release.js +++ b/scripts/github-action/create-github-release.js @@ -222,15 +222,20 @@ function formatTable(prs, tableConfig, title = '') { |${tableConfig.map((config) => config.label).join('|')}| |${tableConfig.map(() => '---').join('|')}| - ${prs.map((pr) => `|${tableConfig.map((config) => formatValue(pr[config.value])).join('|')}|`).join('\n')} + ${prs.map((pr) => `|${tableConfig.map((config) => escapeMarkdownCharacters(pr[config.value])).join('|')}|`).join('\n')} ` } -function formatValue(string) { +/* + * Escape markdown characters in the string + */ +function escapeMarkdownCharacters(string) { return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') } -// Map PRs with affected destinations based on the files changed +/* + * Map PR with affected destinations + */ function mapPRWithAffectedDestinations(pr) { let affectedDestinations = [] if (pr.labels.includes('mode:cloud')) { From fe6d16413b809e30be3c4911721c8388d6ee7734 Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Mon, 24 Jun 2024 12:05:25 +0530 Subject: [PATCH 4/6] bump lerna to latest 6.x.x version --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 133466ef24..05091cd220 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "karma-jasmine": "^5.1.0", "karma-webkit-launcher": "^2.0.0", "karma-webpack": "^5.0.0", - "lerna": "^6.5.0", + "lerna": "^6.6.2", "lint-staged": "^10.5.3", "open": "^8.4.0", "os-browserify": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 0f092081f6..182d5a348a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11047,7 +11047,7 @@ lazystream@^1.0.0: dependencies: readable-stream "^2.0.5" -lerna@^6.5.0: +lerna@^6.6.2: version "6.6.2" resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.6.2.tgz#ad921f913aca4e7307123a598768b6f15ca5804f" integrity sha512-W4qrGhcdutkRdHEaDf9eqp7u4JvI+1TwFy5woX6OI8WPe4PYBdxuILAsvhp614fUG41rKSGDKlOh+AWzdSidTg== From f1f7509a7e6851e767a4447b6bcca74279419396 Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:41:08 +0530 Subject: [PATCH 5/6] simplify formatting --- scripts/github-action/create-github-release.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/github-action/create-github-release.js b/scripts/github-action/create-github-release.js index bec436856a..275a0e3d42 100644 --- a/scripts/github-action/create-github-release.js +++ b/scripts/github-action/create-github-release.js @@ -143,7 +143,8 @@ async function getPRsBetweenCommits(github, context, core, lastCommit, currentCo return prsMerged.search.nodes.map((pr) => ({ number: `[#${pr.number}](${pr.url})`, - title: pr.title, + // escape the pipe character in the title to avoid table formatting issues + title: pr.title.replace('|', '\\|'), url: pr.url, files: pr.files.nodes.map((file) => file.path), author: `@${pr.author.login}`, @@ -222,17 +223,9 @@ function formatTable(prs, tableConfig, title = '') { |${tableConfig.map((config) => config.label).join('|')}| |${tableConfig.map(() => '---').join('|')}| - ${prs.map((pr) => `|${tableConfig.map((config) => escapeMarkdownCharacters(pr[config.value])).join('|')}|`).join('\n')} + ${prs.map((pr) => `|${tableConfig.map((config) => pr[config.value]).join('|')}|`).join('\n')} ` } - -/* - * Escape markdown characters in the string - */ -function escapeMarkdownCharacters(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') -} - /* * Map PR with affected destinations */ From 8cc68c185b6c78925c30889302cfc5c29d62814c Mon Sep 17 00:00:00 2001 From: Varadarajan V <109586712+varadarajan-tw@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:43:52 +0530 Subject: [PATCH 6/6] Revert lerna update --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 05091cd220..133466ef24 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "karma-jasmine": "^5.1.0", "karma-webkit-launcher": "^2.0.0", "karma-webpack": "^5.0.0", - "lerna": "^6.6.2", + "lerna": "^6.5.0", "lint-staged": "^10.5.3", "open": "^8.4.0", "os-browserify": "^0.3.0", diff --git a/yarn.lock b/yarn.lock index 182d5a348a..0f092081f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11047,7 +11047,7 @@ lazystream@^1.0.0: dependencies: readable-stream "^2.0.5" -lerna@^6.6.2: +lerna@^6.5.0: version "6.6.2" resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.6.2.tgz#ad921f913aca4e7307123a598768b6f15ca5804f" integrity sha512-W4qrGhcdutkRdHEaDf9eqp7u4JvI+1TwFy5woX6OI8WPe4PYBdxuILAsvhp614fUG41rKSGDKlOh+AWzdSidTg==