From ebfcd1f0587e0a81227b8ad8f91b76b7120e6360 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 31 Aug 2022 21:46:44 +0100 Subject: [PATCH] adding automatic sync back to main from the release branch - is a PR to catch merge conflicts --- tools/beta-release/app.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/beta-release/app.js b/tools/beta-release/app.js index bfbbd4d..c951298 100644 --- a/tools/beta-release/app.js +++ b/tools/beta-release/app.js @@ -22,14 +22,25 @@ export const startReleaseProcess = async ({ github, context, core }) => { } export const publishRelease = async (github, artifacts) => { - const versionFile = await readVersionFile(github, "release") + const versionFile = await readVersionFile(github, config.rcMergesTo) await release( github, versionFile.content, config.packageName, artifacts, 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) => { @@ -77,7 +88,11 @@ const startRelease = async (github) => { body: "todo", }) - github.graphql( + await enablePrAutoMerge(createdPr.data.node_id) +} + +const enablePrAutoMerge = async (prNodeId) => { + await github.graphql( ` mutation ($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) { enablePullRequestAutoMerge(input: { @@ -96,7 +111,7 @@ const startRelease = async (github) => { } `, { - pullRequestId: createdPr.data.node_id, + pullRequestId: prNodeId, mergeMethod: "MERGE" } )