Files
cypress/scripts/github-actions/create-pull-request.js
Ben M 849da7c6f5 chore: update chrome PR creation workflow to add to firewatch board (#27821)
* chore: update chrome PR creation workflow to add to firewatch board

* chore: adding in ability to manually run job

* chore: changing how we add the chrome update PR to the firewatch board
2023-09-15 13:00:45 -04:00

49 lines
1.1 KiB
JavaScript

const createPullRequest = async ({ context, github, baseBranch, branchName, description, body, reviewers, addToProjectBoard }) => {
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,
})
}
if (addToProjectBoard) {
const addToProjectBoardQuery = `
mutation ($project_id: ID!, $item_id: ID!) {
addProjectV2ItemById(input: {contentId: $item_id, projectId: $project_id}) {
clientMutationId
item {
id
}
}
}`
const addToProjectBoardQueryVars = {
project_id: 9,
item_id: number,
}
const addToProjectBoard = await github.graphql(
addToProjectBoardQuery,
addToProjectBoardQueryVars
)
}
}
module.exports = {
createPullRequest,
}