Skip to content

Commit

Permalink
feat(pr): add license and publisher info to pr text
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba authored and Realtin committed Jul 4, 2019
1 parent 1ee49fc commit a98e709
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
9 changes: 8 additions & 1 deletion content/update-pr.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const _ = require('lodash')
const md = require('./template')

module.exports = ({ version, dependencyLink, dependency, monorepoGroupName, release, diffCommits, oldVersionResolved, type, packageUpdateList }) => {
module.exports = ({
version, dependencyLink, dependency, monorepoGroupName, release, diffCommits, oldVersionResolved, type, packageUpdateList, license, licenseHasChanged, publisher
}) => {
const hasReleaseInfo = release && diffCommits
return md`
${monorepoGroupName
Expand All @@ -15,6 +17,11 @@ ${monorepoGroupName && `\nThis monorepo update includes releases of one or more
}
---
publisher: ${publisher}
${licenseHasChanged ? `License has changed from the prevoius release.` : ''}
license: ${license}
---
${hasReleaseInfo
? _.compact([release, diffCommits])
: `[Find out more about this release](${dependencyLink}).`
Expand Down
10 changes: 9 additions & 1 deletion jobs/create-group-version-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ module.exports = async function (
prTitles: config.prTitles })

const dependencyLink = getFormattedDependencyURL({ repositoryURL: transforms[0].repoURL })

const license = versions[version].license
const licenseHasChanged = versions[oldVersionResolved].license !== license
const publisher = versions[version]['_npmUser'].name

// maybe adapt PR body
const body = prContent({
dependencyLink,
Expand All @@ -370,7 +375,10 @@ module.exports = async function (
type: highestPriorityDependency,
release,
diffCommits,
packageUpdateList
packageUpdateList,
license,
licenseHasChanged,
publisher
})

// verify pull requests commit
Expand Down
11 changes: 9 additions & 2 deletions jobs/create-version-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = async function (
accountId,
repositoryId,
type,
// The following 4 don’t matter anymore, since we fetch them anew for every dependency anyway
// The following 4 don’t matter anymore, sincversionse we fetch them anew for every dependency anyway
version,
oldVersion,
oldVersionResolved,
Expand Down Expand Up @@ -336,6 +336,10 @@ module.exports = async function (
dependency: dependencyKey,
prTitles: config.prTitles })

const license = versions[version].license
const licenseHasChanged = versions[oldVersionResolved].license !== license
const publisher = versions[version]['_npmUser'].name

const body = prContent({
dependencyLink,
oldVersionResolved,
Expand All @@ -345,7 +349,10 @@ module.exports = async function (
diffCommits,
monorepoGroupName,
type,
packageUpdateList
packageUpdateList,
license,
licenseHasChanged,
publisher
})

// verify pull requests commit
Expand Down
24 changes: 22 additions & 2 deletions test/jobs/create-version-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,28 @@ describe('create version branch', () => {
oldVersion: '^1.0.0',
oldVersionResolved: '1.0.0',
versions: {
'1.0.0': {},
'2.0.0': {}
'1.0.0': {
'repository': {
type: 'git',
url: 'git+https://github.com/lodash/lodash.git'
},
'license': 'MIT',
'_npmUser': {
name: 'jdalton',
email: '[email protected]'
}
},
'2.0.0': {
'repository': {
type: 'git',
url: 'git+https://github.com/lodash/lodash.git'
},
'license': 'TIM',
'_npmUser': {
name: 'jdalton',
email: '[email protected]'
}
}
}
})

Expand Down

0 comments on commit a98e709

Please sign in to comment.