Skip to content

Commit a98e709

Browse files
hulkobaRealtin
authored andcommitted
feat(pr): add license and publisher info to pr text
1 parent 1ee49fc commit a98e709

File tree

4 files changed

+48
-6
lines changed

4 files changed

+48
-6
lines changed

content/update-pr.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
const _ = require('lodash')
22
const md = require('./template')
33

4-
module.exports = ({ version, dependencyLink, dependency, monorepoGroupName, release, diffCommits, oldVersionResolved, type, packageUpdateList }) => {
4+
module.exports = ({
5+
version, dependencyLink, dependency, monorepoGroupName, release, diffCommits, oldVersionResolved, type, packageUpdateList, license, licenseHasChanged, publisher
6+
}) => {
57
const hasReleaseInfo = release && diffCommits
68
return md`
79
${monorepoGroupName
@@ -15,6 +17,11 @@ ${monorepoGroupName && `\nThis monorepo update includes releases of one or more
1517
}
1618
---
1719
20+
publisher: ${publisher}
21+
${licenseHasChanged ? `License has changed from the prevoius release.` : ''}
22+
license: ${license}
23+
24+
---
1825
${hasReleaseInfo
1926
? _.compact([release, diffCommits])
2027
: `[Find out more about this release](${dependencyLink}).`

jobs/create-group-version-branch.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@ module.exports = async function (
360360
prTitles: config.prTitles })
361361

362362
const dependencyLink = getFormattedDependencyURL({ repositoryURL: transforms[0].repoURL })
363+
364+
const license = versions[version].license
365+
const licenseHasChanged = versions[oldVersionResolved].license !== license
366+
const publisher = versions[version]['_npmUser'].name
367+
363368
// maybe adapt PR body
364369
const body = prContent({
365370
dependencyLink,
@@ -370,7 +375,10 @@ module.exports = async function (
370375
type: highestPriorityDependency,
371376
release,
372377
diffCommits,
373-
packageUpdateList
378+
packageUpdateList,
379+
license,
380+
licenseHasChanged,
381+
publisher
374382
})
375383

376384
// verify pull requests commit

jobs/create-version-branch.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module.exports = async function (
3434
accountId,
3535
repositoryId,
3636
type,
37-
// The following 4 don’t matter anymore, since we fetch them anew for every dependency anyway
37+
// The following 4 don’t matter anymore, sincversionse we fetch them anew for every dependency anyway
3838
version,
3939
oldVersion,
4040
oldVersionResolved,
@@ -336,6 +336,10 @@ module.exports = async function (
336336
dependency: dependencyKey,
337337
prTitles: config.prTitles })
338338

339+
const license = versions[version].license
340+
const licenseHasChanged = versions[oldVersionResolved].license !== license
341+
const publisher = versions[version]['_npmUser'].name
342+
339343
const body = prContent({
340344
dependencyLink,
341345
oldVersionResolved,
@@ -345,7 +349,10 @@ module.exports = async function (
345349
diffCommits,
346350
monorepoGroupName,
347351
type,
348-
packageUpdateList
352+
packageUpdateList,
353+
license,
354+
licenseHasChanged,
355+
publisher
349356
})
350357

351358
// verify pull requests commit

test/jobs/create-version-branch.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,28 @@ describe('create version branch', () => {
268268
oldVersion: '^1.0.0',
269269
oldVersionResolved: '1.0.0',
270270
versions: {
271-
'1.0.0': {},
272-
'2.0.0': {}
271+
'1.0.0': {
272+
'repository': {
273+
type: 'git',
274+
url: 'git+https://github.com/lodash/lodash.git'
275+
},
276+
'license': 'MIT',
277+
'_npmUser': {
278+
name: 'jdalton',
279+
email: 'john.david.dalton@gmail.com'
280+
}
281+
},
282+
'2.0.0': {
283+
'repository': {
284+
type: 'git',
285+
url: 'git+https://github.com/lodash/lodash.git'
286+
},
287+
'license': 'TIM',
288+
'_npmUser': {
289+
name: 'jdalton',
290+
email: 'john.david.dalton@gmail.com'
291+
}
292+
}
273293
}
274294
})
275295

0 commit comments

Comments
 (0)