Files
cypress/scripts/github-actions/create-pull-request.js
2023-03-30 20:16:10 -05:00

25 lines
596 B
JavaScript

const createPullRequest = async ({ context, github, baseBranch, branchName, description, body, reviewers }) => {
const { data: { number } } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
base: baseBranch,
head: branchName,
title: `chore: ${description}`,
body,
maintainer_can_modify: true,
})
if (reviewers) {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: number,
reviewers,
})
}
}
module.exports = {
createPullRequest,
}