Created
June 20, 2020 15:41
-
-
Save nicolasnoble/dee2df70cfd5843e315e2521d0cf837d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const github = require('octonode') | |
const repoName = /* repository name */ | |
const client = github.client(/* user token */) | |
const repo = client.repo(repoName) | |
async function migrateAll() { | |
let page = 1 | |
while (true) { | |
const prsResult = await repo.prsAsync({page: page, state: 'open'}) | |
const prs = prsResult[0] | |
page = page + 1 | |
if (prs.length === 0) return | |
for (let i = 0; i < prs.length; i++) { | |
if (prs[i].base.ref !== 'master') return | |
console.log('Migrating ' + prs[i].number) | |
const ghpr = client.pr(repoName, prs[i].number) | |
await ghpr.updateAsync({'base': 'main'}) | |
} | |
} | |
} | |
migrateAll().then(console.log).catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment