auths
objectThe name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.
The title of the new pull request.
return
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params, auths) => {
}
//See the API docs here: https://developer.github.com/v3/pulls/#create-a-pull-request
const data = {
base: params.base,
body: params.body,
head: params.head,
title: params.title,
maintainer_can_modify: true,
}
const headers = {
"Authorization": `Bearer ${auths.github.oauth_access_token}`,
"Content-Type": "application/json"
}
// // get hash of master head on target repo
// const head = await require("@pipedreamhq/platform").axios(this, {
// method: "get",
// url: `https://api.github.com/repos/${params.owner}/${params.repo}/git/refs/heads/master`,
// headers,
// data
// });
// const headHash = head.object.sha
// console.log({headHash})
// const timestamp = new Date().valueOf().toString();
// const tempBranchName = "source-sync-" + timestamp
// console.log({tempBranchName})
// // create new temp branch in target repo
// await require("@pipedreamhq/platform").axios(this, {
// method: "post",
// url: `https://api.github.com/repos/${params.owner}/${params.repo}/git/refs`,
// headers,
// data: {
// owner: params.owner,
// repo: params.repo,
// ref: `refs/heads/${tempBranchName}`,
// sha: headHash
// }
// });
return await require("@pipedreamhq/platform").axios(this, {
method: "post",
url: `https://api.github.com/repos/${params.owner}/${params.repo}/pulls`,
headers: {
Authorization: `Bearer ${auths.github.oauth_access_token}`,
"Content-Type": "application/json"
},
data
});