Skip to content

Commit

Permalink
[Release Scripts] Fix changelog formatting and bump checkout/setup-no…
Browse files Browse the repository at this point in the history
…de github action versions (#2052)

* [Release Notes] Escape markdown special characters

* Bump checkout and setup node to v4

* add some comments

* bump lerna to latest 6.x.x version

* simplify formatting

* Revert lerna update
  • Loading branch information
varadarajan-tw authored Jun 25, 2024
1 parent 240bc6f commit eca12ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions scripts/github-action/create-github-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down Expand Up @@ -200,15 +201,15 @@ function formatChangeLog(prs, tagsContext, context) {

const changelog = `
# What's New
https://github.com/${context.repo.owner}/${context.repo.repo}/compare/${releaseDiff}
## Packages Published
${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
Expand All @@ -225,8 +226,9 @@ function formatTable(prs, tableConfig, title = '') {
${prs.map((pr) => `|${tableConfig.map((config) => pr[config.value]).join('|')}|`).join('\n')}
`
}

// 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')) {
Expand Down

0 comments on commit eca12ae

Please sign in to comment.