adding automatic sync back to main from the release branch

- is a PR to catch merge conflicts
This commit is contained in:
Adam Brown 2022-08-31 21:46:44 +01:00
parent 53dd303553
commit ebfcd1f058
1 changed files with 19 additions and 4 deletions

View File

@ -22,14 +22,25 @@ export const startReleaseProcess = async ({ github, context, core }) => {
} }
export const publishRelease = async (github, artifacts) => { export const publishRelease = async (github, artifacts) => {
const versionFile = await readVersionFile(github, "release") const versionFile = await readVersionFile(github, config.rcMergesTo)
await release( await release(
github, github,
versionFile.content, versionFile.content,
config.packageName, config.packageName,
artifacts, artifacts,
config, config,
).catch((error) => console.log(error)) )
const createdPr = await github.rest.pulls.create({
owner: config.owner,
repo: config.repo,
title: "[Auto] Sync Release",
head: config.rcMergesTo,
base: config.rcBranchesFrom,
body: "Syncing changes from release",
})
await enablePrAutoMerge(createdPr.data.node_id)
} }
const isWorkingBranchAhead = async (github) => { const isWorkingBranchAhead = async (github) => {
@ -77,7 +88,11 @@ const startRelease = async (github) => {
body: "todo", body: "todo",
}) })
github.graphql( await enablePrAutoMerge(createdPr.data.node_id)
}
const enablePrAutoMerge = async (prNodeId) => {
await github.graphql(
` `
mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) { mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
enablePullRequestAutoMerge(input: { enablePullRequestAutoMerge(input: {
@ -96,7 +111,7 @@ const startRelease = async (github) => {
} }
`, `,
{ {
pullRequestId: createdPr.data.node_id, pullRequestId: prNodeId,
mergeMethod: "MERGE" mergeMethod: "MERGE"
} }
) )