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" } )