Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install-latest-npm and collapse chores #389

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/install-latest-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ runs:
shell: bash
env:
NODE_VERSION: ${{ inputs.node }}
working-directory: ${{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
Expand Down
1 change: 1 addition & 0 deletions lib/content/action-install-latest-npm-yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ runs:
shell: bash
env:
NODE_VERSION: $\{{ inputs.node }}
working-directory: $\{{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
Expand Down
10 changes: 5 additions & 5 deletions lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ module.exports = {
},
allowedPackages: [],
changelogTypes: [
{ type: 'feat', section: 'Features', hidden: false },
{ type: 'fix', section: 'Bug Fixes', hidden: false },
{ type: 'docs', section: 'Documentation', hidden: false },
{ type: 'deps', section: 'Dependencies', hidden: false },
{ type: 'chore', section: 'Chores', hidden: false },
{ type: 'feat', section: 'Features', hidden: false, collapse: false },
{ type: 'fix', section: 'Bug Fixes', hidden: false, collapse: false },
{ type: 'docs', section: 'Documentation', hidden: false, collapse: false },
{ type: 'deps', section: 'Dependencies', hidden: false, collapse: false },
{ type: 'chore', section: 'Chores', hidden: false, collapse: true },
],
}
14 changes: 13 additions & 1 deletion lib/release/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Changelog {
#title
#entries = {}
#types = new Set([Changelog.BREAKING])
#sections = {}
#titles = {
[Changelog.BREAKING]: '⚠️ BREAKING CHANGES',
}
Expand All @@ -14,6 +15,7 @@ class Changelog {
this.#title = `## ${url ? link(version, url) : version} (${formatDate()})`
for (const section of sections) {
this.#types.add(section.type)
this.#sections[section.type] = section
this.#titles[section.type] = section.section
}
}
Expand All @@ -26,14 +28,24 @@ class Changelog {
this.#entries[type].push(...entries)
}

#getEntries (type) {
const section = this.#sections[type]
const entries = this.#entries[type].map(list)
if (section?.collapse) {
entries.unshift('<details><summary>Commits</summary>\n')
entries.push('\n</details>')
}
return entries.join('\n')
}

toString () {
const body = [this.#title]
for (const type of this.#types) {
const title = this.#titles[type]
if (this.#entries[type]?.length) {
body.push(
`### ${title}`,
this.#entries[type].map(list).join('\n')
this.#getEntries(type)
)
}
}
Expand Down
15 changes: 10 additions & 5 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,32 @@
{
"type": "feat",
"section": "Features",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
"hidden": false,
"collapse": true
}
],
"packages": {
Expand Down
48 changes: 33 additions & 15 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ runs:
shell: bash
env:
NODE_VERSION: \${{ inputs.node }}
working-directory: \${{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
Expand Down Expand Up @@ -1364,27 +1365,32 @@ release-please-config.json
{
"type": "feat",
"section": "Features",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
"hidden": false,
"collapse": true
}
],
"prerelease-type": "pre",
Expand Down Expand Up @@ -1557,6 +1563,7 @@ runs:
shell: bash
env:
NODE_VERSION: \${{ inputs.node }}
working-directory: \${{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
Expand Down Expand Up @@ -3018,27 +3025,32 @@ release-please-config.json
{
"type": "feat",
"section": "Features",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
"hidden": false,
"collapse": true
}
],
"prerelease-type": "pre",
Expand Down Expand Up @@ -3321,6 +3333,7 @@ runs:
shell: bash
env:
NODE_VERSION: \${{ inputs.node }}
working-directory: \${{ runner.temp }}
run: |
MATCH=""
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
Expand Down Expand Up @@ -4389,27 +4402,32 @@ release-please-config.json
{
"type": "feat",
"section": "Features",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "docs",
"section": "Documentation",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "deps",
"section": "Dependencies",
"hidden": false
"hidden": false,
"collapse": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
"hidden": false,
"collapse": true
}
],
"prerelease-type": "pre",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/release/release-please.js TAP cases chore commit > pr chore: this is a chore 1`] = `
Object {
"baseBranchName": "template-oss-mock-testing-branch-do-not-delete",
"body": String(
:robot: I have created a release *beep* *boop*
---


<details><summary>2016.0.2-pre</summary>

## [2016.0.2-pre](https://github.com/npm/npm-cli-release-please/compare/v2016.0.1-pre...v2016.0.2-pre) (2023-12-04)

### Chores

<details><summary>Commits</summary>

* [\`d690bcb\`](https://github.com/npm/npm-cli-release-please/commit/d690bcb622f954314086bc333cd56fa4d2b59897) this is a chore (@lukekarrys)
* [\`38acd0f\`](https://github.com/npm/npm-cli-release-please/commit/38acd0f850907c357e51caa56faa42526ace49d9) update template-oss (@lukekarrys)

</details>
</details>

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
),
"files": Array [],
"headBranchName": "release-please--branches--template-oss-mock-testing-branch-do-not-delete",
"labels": Array [
"autorelease: pending",
],
"number": 264,
"sha": "675ff2fa3a03500ce5748e38d05c003d80943e43",
"title": "chore: release 2016.0.2-pre",
}
`

exports[`test/release/release-please.js TAP cases chore commit > releases chore commit 1`] = `
Array [
Object {
"draft": false,
"id": 132552731,
"major": 2016,
"minor": 0,
"name": "v2016.0.2-pre",
"notes": String(
## [2016.0.2-pre](https://github.com/npm/npm-cli-release-please/compare/v2016.0.1-pre...v2016.0.2-pre) (2023-12-04)

### Chores

Commits

* [\`d690bcb\`](https://github.com/npm/npm-cli-release-please/commit/d690bcb622f954314086bc333cd56fa4d2b59897) this is a chore (@lukekarrys)
* [\`38acd0f\`](https://github.com/npm/npm-cli-release-please/commit/38acd0f850907c357e51caa56faa42526ace49d9) update template-oss (@lukekarrys)
),
"patch": 2,
"path": ".",
"pkgName": "npm-cli-release-please",
"prNumber": 264,
"publishTag": "prerelease-2016",
"sha": "eaa230680541215efd72568054f187e8cebdd2a5",
"tagName": "v2016.0.2-pre",
"uploadUrl": "https://uploads.github.com/repos/npm/npm-cli-release-please/releases/132552731/assets{?name,label}",
"url": "https://github.com/npm/npm-cli-release-please/releases/tag/v2016.0.2-pre",
"version": "2016.0.2-pre",
},
]
`
Loading