remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/createPRToBeta.ts

46 lines
1.4 KiB

11 months ago
// This script can be used to open a PR for base branch 'remix_beta' using an existing pull request
// Pull request number should be provided while running this script
// It will use the reference branch same as the shared PR
// To create a new PR, Github auth token with scope 'repo' needs to be provided
11 months ago
// Command to run this script: fromPR=4369 authToken=abc123 npx ts-node createPRToBeta.ts
11 months ago
11 months ago
import { Octokit } from "octokit"
11 months ago
async function createPR (prNumber, baseBranch) {
11 months ago
try {
const octokit = new Octokit({
11 months ago
auth: process.env.authToken || ''
})
11 months ago
const owner = 'ethereum'
const repo = 'remix-project'
11 months ago
const prData = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', {
11 months ago
owner: owner,
repo: repo,
pull_number: prNumber,
headers: {
'X-GitHub-Api-Version': '2022-11-28'
}
})
const response = await octokit.request('POST /repos/{owner}/{repo}/pulls', {
11 months ago
owner: owner,
repo: repo,
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)
11 months ago
11 months ago
} catch (error) {
console.error('Error during PR creation: ', error.message)
}
}
11 months ago
createPR(process.env.fromPR, 'remix_beta')