Skip to content

Commit

Permalink
feat: raise PR on branch create
Browse files Browse the repository at this point in the history
add a body and title to the PR
  • Loading branch information
ghinks committed Apr 7, 2021
1 parent 761feef commit d1566eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ module.exports.getCommitStatusesForRef = async function getCommitStatusesForRef
})
}

module.exports.createPR = async function createPR (owner, repo, title, head, base, draft) {
module.exports.createPR = async function createPR (owner, repo, title, head, base, draft, body) {
return octokit.pulls.create({
owner,
repo,
title,
head,
base,
draft
draft,
body
})
}
13 changes: 7 additions & 6 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = async function ({ dependents, pullrequest }) {
const patchedPackageJSON = applyPatch(parentDependencyLink, parentPkgJSON.name, dependentPkgJson, parentPkgJSON.name)
await pushPatch(patchedPackageJSON, dependentRepositoryInfo.owner, dependentRepositoryInfo.name, parentPkgJSON.name, parentBranchName)
if (pullrequest) {
await createPR(dependentRepositoryInfo.owner, dependentRepositoryInfo.name, parentBranchName)
await createPR(dependentRepositoryInfo.owner, dependentRepositoryInfo.name, parentBranchName, parentDependencyLink)
}
}
}
Expand Down Expand Up @@ -62,13 +62,14 @@ async function pushPatch (dependentPkgJson, dependentOwner, dependentRepo, paren
debug(`Changes pushed to https://github.com/${dependentOwner}/${dependentRepo}/blob/${branch}/package.json`)
}

const createPR = module.exports.createPR = async function createPR (dependentOwner, dependentRepo, parentBranchName) {
const owner = dependentOwner
const repo = dependentRepo
const title = 'title #1'
const createPR = module.exports.createPR = async function createPR (dependentOwner, dependentRepo, parentBranchName, parentDependencyLink) {
const title = `Wiby changes to ${parentDependencyLink}`
const body = `Wiby has raised this PR to kick off automated jobs.
You are dependent upon ${parentDependencyLink}
`
const head = context.getTestingBranchName(parentBranchName)
const draft = true
const result = await github.createPR(owner, repo, title, head, parentBranchName, draft)
const result = await github.createPR(dependentOwner, dependentRepo, title, head, parentBranchName, draft, body)
debug(`PR raised upon ${result.data.html_url}`)
return result
}

0 comments on commit d1566eb

Please sign in to comment.