From 79bd043bb9f2f14b56e502dfc38f713e2b40e692 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 22 Dec 2023 14:28:50 +0530 Subject: [PATCH] add script to create PR --- createPR.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 createPR.js diff --git a/createPR.js b/createPR.js new file mode 100644 index 0000000000..fc4786a674 --- /dev/null +++ b/createPR.js @@ -0,0 +1,34 @@ +const { Octokit } = require("octokit"); + +async function createPR(prNumber, baseBranch) { + const octokit = new Octokit({ + auth: '' + }) + + const prData = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', { + owner: 'ethereum', + repo: 'remix-project', + pull_number: prNumber, + headers: { + 'X-GitHub-Api-Version': '2022-11-28' + } + }) + + const response = await octokit.request('POST /repos/{owner}/{repo}/pulls', { + owner: 'ethereum', + repo: 'remix-project', + title: prData.data.title + ' (for beta)', + body: prData.data.body + ' (for beta)', + head: prData.data.head.ref, + base: baseBranch, + headers: { + 'X-GitHub-Api-Version': '2022-11-28' + } + }) + + console.log('Pull Request Created!!! See: ', response.data.html_url) +} + +createPR(process.env.fromPR, process.env.baseBranch || 'remix_beta') + +// Run: fromPR=4369 node testGHAPI.js \ No newline at end of file