@@ -76,12 +76,13 @@ A full set list of possible output values for this action.
|
||||
|
||||
| **Output** | **Description** |
|
||||
|---------------------|---------------------------------------------------------------------------------------------------------------------------|
|
||||
| `outputs.changelog` | The built release changelog built from the merged pull requests |
|
||||
| `outputs.owner` | Specifies the owner of the repository processed |
|
||||
| `outputs.repo` | Describes the repository name, which was processed |
|
||||
| `outputs.fromTag` | Defines the `fromTag` which describes the lower bound to process pull requests for |
|
||||
| `outputs.toTag` | Defines the `toTag` which describes the upper bound to process pull request for |
|
||||
| `outputs.failed` | Defines if there was an issue with the action run, and the changelog may not have been generated correctly. [true, false] |
|
||||
| `outputs.changelog` | The built release changelog built from the merged pull requests |
|
||||
| `outputs.owner` | Specifies the owner of the repository processed |
|
||||
| `outputs.repo` | Describes the repository name, which was processed |
|
||||
| `outputs.fromTag` | Defines the `fromTag` which describes the lower bound to process pull requests for |
|
||||
| `outputs.toTag` | Defines the `toTag` which describes the upper bound to process pull request for |
|
||||
| `outputs.failed` | Defines if there was an issue with the action run, and the changelog may not have been generated correctly. [true, false] |
|
||||
| `outputs.pull_requests` | Defines a `,` joined array with all PR IDs associated with the generated changelog. |
|
||||
|
||||
|
||||
## Full Sample 🖥️
|
||||
@@ -296,8 +297,9 @@ Table of descriptions for the `configuration.json` options to configure the resu
|
||||
| empty_template | Template to pick if no changes are detected. See [Template placeholders](#template-placeholders) for possible values |
|
||||
| label_extractor | An array of `transform` specifications, offering a flexible API to extract additinal labels from a PR (Default: `body`, Default in commit mode: `commit message`). |
|
||||
| label_extractor.pattern | A `regex` pattern, extracting values of the change message. |
|
||||
| label_extractor.target | The result pattern. The result text will be used as label. If empty, no label is created. |
|
||||
| label_extractor.target | The result pattern. The result text will be used as label. If empty, no label is created. (Unused for `match` method) |
|
||||
| label_extractor.on_property | The property to retrieve the text from. This is optional. Defaults to: `body`. Alternative values: `title`, `author`, `milestone`. |
|
||||
| label_extractor.method | The extraction method used. Defaults to: `replace`. Alternative value: `match`. The method specified references the JavaScript String method. |
|
||||
| label_extractor.flags | Defines the regex flags specified for the pattern. Default: `gu` |
|
||||
| transformers | An array of `transform` specifications, offering a flexible API to modify the text per pull request. This is applied on the change text created with `pr_template`. `transformers` are executed per change, in the order specified |
|
||||
| transformer.pattern | A `regex` pattern, extracting values of the change message. |
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
import {buildChangelog} from '../src/transform'
|
||||
import { PullRequestInfo } from '../src/pullRequests'
|
||||
import moment from 'moment'
|
||||
import { DefaultConfiguration } from '../src/configuration';
|
||||
|
||||
jest.setTimeout(180000)
|
||||
|
||||
let configuration = DefaultConfiguration
|
||||
configuration.categories = [
|
||||
{
|
||||
"title": "## 🚀 Features",
|
||||
"labels": ["[Feature]"]
|
||||
},
|
||||
{
|
||||
"title": "## 🐛 Fixes",
|
||||
"labels": ["[Bug]", "[Issue]"]
|
||||
},
|
||||
{
|
||||
"title": "## 🧪 Tests",
|
||||
"labels": ["[Test]"]
|
||||
}
|
||||
]
|
||||
|
||||
let mergedPullRequests: PullRequestInfo[] = []
|
||||
mergedPullRequests.push({
|
||||
number: 1,
|
||||
title: "[Feature][AB-1234] - this is a PR 1 title message",
|
||||
htmlURL: "",
|
||||
baseBranch: "",
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: "sha1",
|
||||
author: "Mike",
|
||||
repoName: "test-repo",
|
||||
labels: new Set<string>(),
|
||||
milestone: "",
|
||||
body: "no magic body for this matter",
|
||||
assignees: [],
|
||||
requestedReviewers: []
|
||||
}, {
|
||||
number: 2,
|
||||
title: "[Issue][AB-4321] - this is a PR 2 title message",
|
||||
htmlURL: "",
|
||||
baseBranch: "",
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: "sha1",
|
||||
author: "Mike",
|
||||
repoName: "test-repo",
|
||||
labels: new Set<string>(),
|
||||
milestone: "",
|
||||
body: "no magic body for this matter",
|
||||
assignees: [],
|
||||
requestedReviewers: []
|
||||
}, {
|
||||
number: 3,
|
||||
title: "[Issue][Feature][AB-1234321] - this is a PR 3 title message",
|
||||
htmlURL: "",
|
||||
baseBranch: "",
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: "sha1",
|
||||
author: "Mike",
|
||||
repoName: "test-repo",
|
||||
labels: new Set<string>(),
|
||||
milestone: "",
|
||||
body: "no magic body for this matter",
|
||||
assignees: [],
|
||||
requestedReviewers: []
|
||||
}, {
|
||||
number: 4,
|
||||
title: "[AB-404] - not found label",
|
||||
htmlURL: "",
|
||||
baseBranch: "",
|
||||
mergedAt: moment(),
|
||||
mergeCommitSha: "sha1",
|
||||
author: "Mike",
|
||||
repoName: "test-repo",
|
||||
labels: new Set<string>(),
|
||||
milestone: "",
|
||||
body: "no magic body for this matter",
|
||||
assignees: [],
|
||||
requestedReviewers: []
|
||||
})
|
||||
|
||||
it('Extract label from title, combined regex', async () => {
|
||||
configuration.label_extractor = [
|
||||
{
|
||||
"pattern": ".*(\\[Feature\\]|\\[Issue\\]).*",
|
||||
"target": "$1",
|
||||
"on_property": "title"
|
||||
}
|
||||
]
|
||||
|
||||
const resultChangelog = buildChangelog(
|
||||
mergedPullRequests,
|
||||
{
|
||||
owner: "mikepenz",
|
||||
repo: "test-repo",
|
||||
fromTag: "1.0.0",
|
||||
toTag: "2.0.0",
|
||||
failOnError: false,
|
||||
commitMode: false,
|
||||
configuration: configuration
|
||||
}
|
||||
)
|
||||
|
||||
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n\n`)
|
||||
})
|
||||
|
||||
it('Extract label from title, split regex', async () => {
|
||||
configuration.label_extractor = [
|
||||
{
|
||||
"pattern": ".*(\\[Feature\\]).*",
|
||||
"target": "$1",
|
||||
"on_property": "title"
|
||||
},
|
||||
{
|
||||
"pattern": ".*(\\[Issue\\]).*",
|
||||
"target": "$1",
|
||||
"on_property": "title"
|
||||
}
|
||||
]
|
||||
|
||||
const resultChangelog = buildChangelog(
|
||||
mergedPullRequests,
|
||||
{
|
||||
owner: "mikepenz",
|
||||
repo: "test-repo",
|
||||
fromTag: "1.0.0",
|
||||
toTag: "2.0.0",
|
||||
failOnError: false,
|
||||
commitMode: false,
|
||||
configuration: configuration
|
||||
}
|
||||
)
|
||||
|
||||
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`)
|
||||
})
|
||||
|
||||
it('Extract label from title, match', async () => {
|
||||
configuration.label_extractor = [
|
||||
{
|
||||
"pattern": "\\[Feature\\]",
|
||||
"on_property": "title",
|
||||
"method": "match"
|
||||
},
|
||||
{
|
||||
"pattern": "\\[Issue\\]",
|
||||
"on_property": "title",
|
||||
"method": "match"
|
||||
}
|
||||
]
|
||||
|
||||
const resultChangelog = buildChangelog(
|
||||
mergedPullRequests,
|
||||
{
|
||||
owner: "mikepenz",
|
||||
repo: "test-repo",
|
||||
fromTag: "1.0.0",
|
||||
toTag: "2.0.0",
|
||||
failOnError: false,
|
||||
commitMode: false,
|
||||
configuration: configuration
|
||||
}
|
||||
)
|
||||
|
||||
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`)
|
||||
})
|
||||
|
||||
it('Extract label from title, match multiple', async () => {
|
||||
configuration.label_extractor = [
|
||||
{
|
||||
"pattern": "\\[Feature\\]|\\[Issue\\]",
|
||||
"on_property": "title",
|
||||
"method": "match"
|
||||
}
|
||||
]
|
||||
|
||||
const resultChangelog = buildChangelog(
|
||||
mergedPullRequests,
|
||||
{
|
||||
owner: "mikepenz",
|
||||
repo: "test-repo",
|
||||
fromTag: "1.0.0",
|
||||
toTag: "2.0.0",
|
||||
failOnError: false,
|
||||
commitMode: false,
|
||||
configuration: configuration
|
||||
}
|
||||
)
|
||||
|
||||
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`)
|
||||
})
|
||||
+70
-1291
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
Generated
+175
-103
@@ -9,20 +9,20 @@
|
||||
"version": "v1.0.0",
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.4.0",
|
||||
"@actions/core": "^1.5.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@octokit/rest": "^18.9.0",
|
||||
"@octokit/rest": "^18.9.1",
|
||||
"@types/semver": "^7.3.8",
|
||||
"moment": "^2.29.1",
|
||||
"semver": "^7.3.5",
|
||||
"webpack": "^5.50.0"
|
||||
"webpack": "^5.51.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"@typescript-eslint/parser": "^4.29.1",
|
||||
"@vercel/ncc": "^0.29.1",
|
||||
"@types/node": "^16.7.2",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"@vercel/ncc": "^0.29.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-github": "^4.2.0",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
@@ -30,14 +30,14 @@
|
||||
"jest-circus": "^27.0.6",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.3.2",
|
||||
"ts-jest": "^27.0.4",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.4.0.tgz",
|
||||
"integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg=="
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
|
||||
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ=="
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "1.1.0",
|
||||
@@ -1282,26 +1282,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/rest": {
|
||||
"version": "18.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.0.tgz",
|
||||
"integrity": "sha512-VrmrE8gjpuOoDAGjrQq2j9ZhOE6LxaqxaQg0yMrrEnnQZy2ZcAnr5qbVfKsMF0up/48PRV/VFS/2GSMhA7nTdA==",
|
||||
"version": "18.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.1.tgz",
|
||||
"integrity": "sha512-idZ3e5PqXVWOhtZYUa546IDHTHjkGZbj3tcJsN0uhCy984KD865e8GB2WbYDc2ZxFuJRiyd0AftpL2uPNhF+UA==",
|
||||
"dependencies": {
|
||||
"@octokit/core": "^3.5.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.6.2",
|
||||
"@octokit/plugin-request-log": "^1.0.2",
|
||||
"@octokit/plugin-rest-endpoint-methods": "5.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.7.0.tgz",
|
||||
"integrity": "sha512-G7sgccWRYQMwcHJXkDY/sDxbXeKiZkFQqUtzBCwmrzCNj2GQf3VygQ4T/BFL2crLVpIbenkE/c0ErhYOte2MPw==",
|
||||
"dependencies": {
|
||||
"@octokit/types": "^6.24.0",
|
||||
"deprecation": "^2.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@octokit/core": ">=3"
|
||||
"@octokit/plugin-rest-endpoint-methods": "5.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@octokit/types": {
|
||||
@@ -1452,9 +1440,9 @@
|
||||
"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ=="
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz",
|
||||
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw=="
|
||||
"version": "16.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.2.tgz",
|
||||
"integrity": "sha512-TbG4TOx9hng8FKxaVrCisdaxKxqEwJ3zwHoCWXZ0Jw6mnvTInpaB99/2Cy4+XxpXtjNv9/TgfGSvZFyfV/t8Fw=="
|
||||
},
|
||||
"node_modules/@types/prettier": {
|
||||
"version": "2.3.2",
|
||||
@@ -1562,14 +1550,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "4.29.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.1.tgz",
|
||||
"integrity": "sha512-3fL5iN20hzX3Q4OkG7QEPFjZV2qsVGiDhEwwh+EkmE/w7oteiOvUNzmpu5eSwGJX/anCryONltJ3WDmAzAoCMg==",
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.3.tgz",
|
||||
"integrity": "sha512-jrHOV5g2u8ROghmspKoW7pN8T/qUzk0+DITun0MELptvngtMrwUJ1tv5zMI04CYVEUsSrN4jV7AKSv+I0y0EfQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "4.29.1",
|
||||
"@typescript-eslint/types": "4.29.1",
|
||||
"@typescript-eslint/typescript-estree": "4.29.1",
|
||||
"@typescript-eslint/scope-manager": "4.29.3",
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/typescript-estree": "4.29.3",
|
||||
"debug": "^4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1588,6 +1576,80 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.3.tgz",
|
||||
"integrity": "sha512-x+w8BLXO7iWPkG5mEy9bA1iFRnk36p/goVlYobVWHyDw69YmaH9q6eA+Fgl7kYHmFvWlebUTUfhtIg4zbbl8PA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/visitor-keys": "4.29.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.3.tgz",
|
||||
"integrity": "sha512-s1eV1lKNgoIYLAl1JUba8NhULmf+jOmmeFO1G5MN/RBCyyzg4TIOfIOICVNC06lor+Xmy4FypIIhFiJXOknhIg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.3.tgz",
|
||||
"integrity": "sha512-45oQJA0bxna4O5TMwz55/TpgjX1YrAPOI/rb6kPgmdnemRZx/dB0rsx+Ku8jpDvqTxcE1C/qEbVHbS3h0hflag==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/visitor-keys": "4.29.3",
|
||||
"debug": "^4.3.1",
|
||||
"globby": "^11.0.3",
|
||||
"is-glob": "^4.0.1",
|
||||
"semver": "^7.3.5",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10.12.0 || >=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.3.tgz",
|
||||
"integrity": "sha512-MGGfJvXT4asUTeVs0Q2m+sY63UsfnA+C/FDgBKV3itLBmM9H0u+URcneePtkd0at1YELmZK6HSolCqM4Fzs6yA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^8.10.0 || ^10.13.0 || >=11.10.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/typescript-eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "4.29.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.1.tgz",
|
||||
@@ -1663,9 +1725,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vercel/ncc": {
|
||||
"version": "0.29.1",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.29.1.tgz",
|
||||
"integrity": "sha512-92d2AApJtkpampMqKgfqWbYkuFvqRFs8kPkKLTbesSB9RVwWfiI3i6mgBxtZgMV9iRuLPVZ+OBNocKHXZSRj6Q==",
|
||||
"version": "0.29.2",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.29.2.tgz",
|
||||
"integrity": "sha512-eUxibZD92k+rY0oZJFZooGqdVpGkDrrHlUhj9UAWrtoyXCGmNOWC1Kcr2KPrZoHRSlWwHOcRnkn2nGT+aHY2KA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"ncc": "dist/ncc/cli.js"
|
||||
@@ -5213,18 +5275,6 @@
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
@@ -6435,19 +6485,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/ts-jest": {
|
||||
"version": "27.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.4.tgz",
|
||||
"integrity": "sha512-c4E1ECy9Xz2WGfTMyHbSaArlIva7Wi2p43QOMmCqjSSjHP06KXv+aT+eSY+yZMuqsMi3k7pyGsGj2q5oSl5WfQ==",
|
||||
"version": "27.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.5.tgz",
|
||||
"integrity": "sha512-lIJApzfTaSSbtlksfFNHkWOzLJuuSm4faFAfo5kvzOiRAuoN4/eKxVJ2zEAho8aecE04qX6K1pAzfH5QHL1/8w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bs-logger": "0.x",
|
||||
"buffer-from": "1.x",
|
||||
"fast-json-stable-stringify": "2.x",
|
||||
"jest-util": "^27.0.0",
|
||||
"json5": "2.x",
|
||||
"lodash": "4.x",
|
||||
"make-error": "1.x",
|
||||
"mkdirp": "1.x",
|
||||
"semver": "7.x",
|
||||
"yargs-parser": "20.x"
|
||||
},
|
||||
@@ -6459,7 +6507,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.0.0-beta.0 <8",
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/jest": "^27.0.0",
|
||||
"babel-jest": ">=27.0.0 <28",
|
||||
"jest": "^27.0.0",
|
||||
"typescript": ">=3.8 <5.0"
|
||||
@@ -6708,9 +6756,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/webpack": {
|
||||
"version": "5.50.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz",
|
||||
"integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==",
|
||||
"version": "5.51.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.51.1.tgz",
|
||||
"integrity": "sha512-xsn3lwqEKoFvqn4JQggPSRxE4dhsRcysWTqYABAZlmavcoTmwlOb9b1N36Inbt/eIispSkuHa80/FJkDTPos1A==",
|
||||
"dependencies": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
"@types/estree": "^0.0.50",
|
||||
@@ -6971,9 +7019,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.4.0.tgz",
|
||||
"integrity": "sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg=="
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
|
||||
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ=="
|
||||
},
|
||||
"@actions/exec": {
|
||||
"version": "1.1.0",
|
||||
@@ -7963,25 +8011,14 @@
|
||||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
"version": "18.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.0.tgz",
|
||||
"integrity": "sha512-VrmrE8gjpuOoDAGjrQq2j9ZhOE6LxaqxaQg0yMrrEnnQZy2ZcAnr5qbVfKsMF0up/48PRV/VFS/2GSMhA7nTdA==",
|
||||
"version": "18.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.9.1.tgz",
|
||||
"integrity": "sha512-idZ3e5PqXVWOhtZYUa546IDHTHjkGZbj3tcJsN0uhCy984KD865e8GB2WbYDc2ZxFuJRiyd0AftpL2uPNhF+UA==",
|
||||
"requires": {
|
||||
"@octokit/core": "^3.5.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.6.2",
|
||||
"@octokit/plugin-request-log": "^1.0.2",
|
||||
"@octokit/plugin-rest-endpoint-methods": "5.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "5.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.7.0.tgz",
|
||||
"integrity": "sha512-G7sgccWRYQMwcHJXkDY/sDxbXeKiZkFQqUtzBCwmrzCNj2GQf3VygQ4T/BFL2crLVpIbenkE/c0ErhYOte2MPw==",
|
||||
"requires": {
|
||||
"@octokit/types": "^6.24.0",
|
||||
"deprecation": "^2.3.1"
|
||||
}
|
||||
}
|
||||
"@octokit/plugin-rest-endpoint-methods": "5.8.0"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
@@ -8129,9 +8166,9 @@
|
||||
"integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ=="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.6.1.tgz",
|
||||
"integrity": "sha512-Sr7BhXEAer9xyGuCN3Ek9eg9xPviCF2gfu9kTfuU2HkTVAMYSDeX40fvpmo72n5nansg3nsBjuQBrsS28r+NUw=="
|
||||
"version": "16.7.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.2.tgz",
|
||||
"integrity": "sha512-TbG4TOx9hng8FKxaVrCisdaxKxqEwJ3zwHoCWXZ0Jw6mnvTInpaB99/2Cy4+XxpXtjNv9/TgfGSvZFyfV/t8Fw=="
|
||||
},
|
||||
"@types/prettier": {
|
||||
"version": "2.3.2",
|
||||
@@ -8206,15 +8243,58 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "4.29.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.1.tgz",
|
||||
"integrity": "sha512-3fL5iN20hzX3Q4OkG7QEPFjZV2qsVGiDhEwwh+EkmE/w7oteiOvUNzmpu5eSwGJX/anCryONltJ3WDmAzAoCMg==",
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.3.tgz",
|
||||
"integrity": "sha512-jrHOV5g2u8ROghmspKoW7pN8T/qUzk0+DITun0MELptvngtMrwUJ1tv5zMI04CYVEUsSrN4jV7AKSv+I0y0EfQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "4.29.1",
|
||||
"@typescript-eslint/types": "4.29.1",
|
||||
"@typescript-eslint/typescript-estree": "4.29.1",
|
||||
"@typescript-eslint/scope-manager": "4.29.3",
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/typescript-estree": "4.29.3",
|
||||
"debug": "^4.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.3.tgz",
|
||||
"integrity": "sha512-x+w8BLXO7iWPkG5mEy9bA1iFRnk36p/goVlYobVWHyDw69YmaH9q6eA+Fgl7kYHmFvWlebUTUfhtIg4zbbl8PA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/visitor-keys": "4.29.3"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/types": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.3.tgz",
|
||||
"integrity": "sha512-s1eV1lKNgoIYLAl1JUba8NhULmf+jOmmeFO1G5MN/RBCyyzg4TIOfIOICVNC06lor+Xmy4FypIIhFiJXOknhIg==",
|
||||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.3.tgz",
|
||||
"integrity": "sha512-45oQJA0bxna4O5TMwz55/TpgjX1YrAPOI/rb6kPgmdnemRZx/dB0rsx+Ku8jpDvqTxcE1C/qEbVHbS3h0hflag==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"@typescript-eslint/visitor-keys": "4.29.3",
|
||||
"debug": "^4.3.1",
|
||||
"globby": "^11.0.3",
|
||||
"is-glob": "^4.0.1",
|
||||
"semver": "^7.3.5",
|
||||
"tsutils": "^3.21.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "4.29.3",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.3.tgz",
|
||||
"integrity": "sha512-MGGfJvXT4asUTeVs0Q2m+sY63UsfnA+C/FDgBKV3itLBmM9H0u+URcneePtkd0at1YELmZK6HSolCqM4Fzs6yA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.29.3",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
@@ -8259,9 +8339,9 @@
|
||||
}
|
||||
},
|
||||
"@vercel/ncc": {
|
||||
"version": "0.29.1",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.29.1.tgz",
|
||||
"integrity": "sha512-92d2AApJtkpampMqKgfqWbYkuFvqRFs8kPkKLTbesSB9RVwWfiI3i6mgBxtZgMV9iRuLPVZ+OBNocKHXZSRj6Q==",
|
||||
"version": "0.29.2",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.29.2.tgz",
|
||||
"integrity": "sha512-eUxibZD92k+rY0oZJFZooGqdVpGkDrrHlUhj9UAWrtoyXCGmNOWC1Kcr2KPrZoHRSlWwHOcRnkn2nGT+aHY2KA==",
|
||||
"dev": true
|
||||
},
|
||||
"@webassemblyjs/ast": {
|
||||
@@ -10991,12 +11071,6 @@
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
||||
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
|
||||
"dev": true
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
@@ -11890,19 +11964,17 @@
|
||||
}
|
||||
},
|
||||
"ts-jest": {
|
||||
"version": "27.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.4.tgz",
|
||||
"integrity": "sha512-c4E1ECy9Xz2WGfTMyHbSaArlIva7Wi2p43QOMmCqjSSjHP06KXv+aT+eSY+yZMuqsMi3k7pyGsGj2q5oSl5WfQ==",
|
||||
"version": "27.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.0.5.tgz",
|
||||
"integrity": "sha512-lIJApzfTaSSbtlksfFNHkWOzLJuuSm4faFAfo5kvzOiRAuoN4/eKxVJ2zEAho8aecE04qX6K1pAzfH5QHL1/8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bs-logger": "0.x",
|
||||
"buffer-from": "1.x",
|
||||
"fast-json-stable-stringify": "2.x",
|
||||
"jest-util": "^27.0.0",
|
||||
"json5": "2.x",
|
||||
"lodash": "4.x",
|
||||
"make-error": "1.x",
|
||||
"mkdirp": "1.x",
|
||||
"semver": "7.x",
|
||||
"yargs-parser": "20.x"
|
||||
}
|
||||
@@ -12091,9 +12163,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"webpack": {
|
||||
"version": "5.50.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz",
|
||||
"integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==",
|
||||
"version": "5.51.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.51.1.tgz",
|
||||
"integrity": "sha512-xsn3lwqEKoFvqn4JQggPSRxE4dhsRcysWTqYABAZlmavcoTmwlOb9b1N36Inbt/eIispSkuHa80/FJkDTPos1A==",
|
||||
"requires": {
|
||||
"@types/eslint-scope": "^3.7.0",
|
||||
"@types/estree": "^0.0.50",
|
||||
|
||||
+7
-7
@@ -32,20 +32,20 @@
|
||||
"author": "Mike Penz",
|
||||
"license": "Apache 2.0",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.4.0",
|
||||
"@actions/core": "^1.5.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@octokit/rest": "^18.9.0",
|
||||
"@octokit/rest": "^18.9.1",
|
||||
"@types/semver": "^7.3.8",
|
||||
"moment": "^2.29.1",
|
||||
"semver": "^7.3.5",
|
||||
"webpack": "^5.50.0"
|
||||
"webpack": "^5.51.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/node": "^16.6.1",
|
||||
"@typescript-eslint/parser": "^4.29.1",
|
||||
"@vercel/ncc": "^0.29.1",
|
||||
"@types/node": "^16.7.2",
|
||||
"@typescript-eslint/parser": "^4.29.3",
|
||||
"@vercel/ncc": "^0.29.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-github": "^4.2.0",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
@@ -53,7 +53,7 @@
|
||||
"jest-circus": "^27.0.6",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "2.3.2",
|
||||
"ts-jest": "^27.0.4",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@ export interface Category {
|
||||
|
||||
export interface Transformer {
|
||||
pattern: string
|
||||
target: string
|
||||
flags?: string
|
||||
target?: string
|
||||
flags?: string // the regex flag to use for RegExp
|
||||
}
|
||||
|
||||
export interface Extractor extends Transformer {
|
||||
on_property: 'title' | 'author' | 'milestone' | 'body' | undefined
|
||||
on_property?: 'title' | 'author' | 'milestone' | 'body' | undefined // retrieve the property to extract the value from
|
||||
method?: 'replace' | 'match' | undefined // the method to use to extract the value
|
||||
}
|
||||
|
||||
export interface TagResolver {
|
||||
|
||||
+12
-7
@@ -20,12 +20,21 @@ export class ReleaseNotes {
|
||||
constructor(private octokit: Octokit, private options: ReleaseNotesOptions) {}
|
||||
|
||||
async pull(): Promise<string | null> {
|
||||
const {configuration} = this.options
|
||||
|
||||
let mergedPullRequests: PullRequestInfo[]
|
||||
if (!this.options.commitMode) {
|
||||
core.startGroup(`🚀 Load pull requests`)
|
||||
mergedPullRequests = await this.getMergedPullRequests(this.octokit)
|
||||
|
||||
// define the included PRs within this release as output
|
||||
core.setOutput(
|
||||
'pull_requests',
|
||||
mergedPullRequests
|
||||
.map(pr => {
|
||||
return pr.number
|
||||
})
|
||||
.join(',')
|
||||
)
|
||||
|
||||
core.endGroup()
|
||||
} else {
|
||||
core.startGroup(`🚀 Load commit history`)
|
||||
@@ -40,11 +49,7 @@ export class ReleaseNotes {
|
||||
}
|
||||
|
||||
core.startGroup('📦 Build changelog')
|
||||
const resultChangelog = buildChangelog(
|
||||
mergedPullRequests,
|
||||
configuration,
|
||||
this.options
|
||||
)
|
||||
const resultChangelog = buildChangelog(mergedPullRequests, this.options)
|
||||
core.endGroup()
|
||||
return resultChangelog
|
||||
}
|
||||
|
||||
+25
-12
@@ -1,7 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import {
|
||||
Category,
|
||||
Configuration,
|
||||
DefaultConfiguration,
|
||||
Extractor,
|
||||
Transformer
|
||||
@@ -11,10 +10,10 @@ import {ReleaseNotesOptions} from './releaseNotes'
|
||||
|
||||
export function buildChangelog(
|
||||
prs: PullRequestInfo[],
|
||||
config: Configuration,
|
||||
options: ReleaseNotesOptions
|
||||
): string {
|
||||
// sort to target order
|
||||
const config = options.configuration
|
||||
const sort = config.sort || DefaultConfiguration.sort
|
||||
const sortAsc = sort.toUpperCase() === 'ASC'
|
||||
prs = sortPullRequests(prs, sortAsc)
|
||||
@@ -25,7 +24,7 @@ export function buildChangelog(
|
||||
for (const extractor of labelExtractors) {
|
||||
if (extractor.pattern != null) {
|
||||
for (const pr of prs) {
|
||||
let label
|
||||
let onValue
|
||||
if (extractor.onProperty !== undefined) {
|
||||
let value: string = pr[extractor.onProperty]
|
||||
if (value === undefined) {
|
||||
@@ -34,12 +33,23 @@ export function buildChangelog(
|
||||
)
|
||||
value = pr['body']
|
||||
}
|
||||
label = value.replace(extractor.pattern, extractor.target)
|
||||
onValue = value
|
||||
} else {
|
||||
label = pr.body.replace(extractor.pattern, extractor.target)
|
||||
onValue = pr.body
|
||||
}
|
||||
if (label !== '') {
|
||||
pr.labels.add(label.toLocaleLowerCase())
|
||||
|
||||
if (extractor.method === 'match') {
|
||||
const lables = onValue.match(extractor.pattern)
|
||||
if (lables !== null) {
|
||||
for (const label of lables) {
|
||||
pr.labels.add(label.toLocaleLowerCase())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const label = onValue.replace(extractor.pattern, extractor.target)
|
||||
if (label !== '') {
|
||||
pr.labels.add(label.toLocaleLowerCase())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,8 +262,10 @@ function validateTransformers(
|
||||
.map(transformer => {
|
||||
try {
|
||||
let onProperty = undefined
|
||||
let method = undefined
|
||||
if (transformer.hasOwnProperty('on_property')) {
|
||||
onProperty = (transformer as Extractor).on_property
|
||||
method = (transformer as Extractor).method
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -261,15 +273,15 @@ function validateTransformers(
|
||||
transformer.pattern.replace('\\\\', '\\'),
|
||||
transformer.flags ?? 'gu'
|
||||
),
|
||||
target: transformer.target,
|
||||
onProperty
|
||||
target: transformer.target || '',
|
||||
onProperty,
|
||||
method
|
||||
}
|
||||
} catch (e) {
|
||||
core.warning(`⚠️ Bad replacer regex: ${transformer.pattern}`)
|
||||
return {
|
||||
pattern: null,
|
||||
target: '',
|
||||
onProperty: undefined
|
||||
target: ''
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -279,5 +291,6 @@ function validateTransformers(
|
||||
interface RegexTransformer {
|
||||
pattern: RegExp | null
|
||||
target: string
|
||||
onProperty: 'title' | 'author' | 'milestone' | 'body' | undefined
|
||||
onProperty?: 'title' | 'author' | 'milestone' | 'body' | undefined
|
||||
method?: 'replace' | 'match' | undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user