├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── docs ├── master_to_main.gif ├── newbranch.png └── newdefault.png ├── index.js ├── package-lock.json └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependency directory 2 | node_modules 3 | 4 | # Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | lerna-debug.log* 12 | 13 | # Diagnostic reports (https://nodejs.org/api/report.html) 14 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 15 | 16 | # Runtime data 17 | pids 18 | *.pid 19 | *.seed 20 | *.pid.lock 21 | 22 | # Directory for instrumented libs generated by jscoverage/JSCover 23 | lib-cov 24 | 25 | # Coverage directory used by tools like istanbul 26 | coverage 27 | *.lcov 28 | 29 | # nyc test coverage 30 | .nyc_output 31 | 32 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 33 | .grunt 34 | 35 | # Bower dependency directory (https://bower.io/) 36 | bower_components 37 | 38 | # node-waf configuration 39 | .lock-wscript 40 | 41 | # Compiled binary addons (https://nodejs.org/api/addons.html) 42 | build/Release 43 | 44 | # Dependency directories 45 | jspm_packages/ 46 | 47 | # TypeScript v1 declaration files 48 | typings/ 49 | 50 | # TypeScript cache 51 | *.tsbuildinfo 52 | 53 | # Optional npm cache directory 54 | .npm 55 | 56 | # Optional eslint cache 57 | .eslintcache 58 | 59 | # Optional REPL history 60 | .node_repl_history 61 | 62 | # Output of 'npm pack' 63 | *.tgz 64 | 65 | # Yarn Integrity file 66 | .yarn-integrity 67 | 68 | # dotenv environment variables file 69 | .env 70 | .env.test 71 | 72 | # parcel-bundler cache (https://parceljs.org/) 73 | .cache 74 | 75 | # next.js build output 76 | .next 77 | 78 | # nuxt.js build output 79 | .nuxt 80 | 81 | # vuepress build output 82 | .vuepress/dist 83 | 84 | # Serverless directories 85 | .serverless/ 86 | 87 | # FuseBox cache 88 | .fusebox/ 89 | 90 | # DynamoDB Local files 91 | .dynamodb/ 92 | 93 | # OS metadata 94 | .DS_Store 95 | Thumbs.db 96 | 97 | # Ignore built ts files 98 | __tests__/runner/* 99 | lib/**/* -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) Edward Thomson. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 17 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 18 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 19 | OTHER DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # retarget_prs 2 | 3 | ![Master to Main](docs/master_to_main.gif) 4 | 5 | This utility will change the base of all the pull requests in your GitHub repository that are currently targeting a different branch. This is useful if you want to [change the name of your default branch](https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx), but you have pull requests open. 6 | 7 | For example, if you use the _default_ default branch of `master`, but you want to change that to a name like `main`, by default the pull requests that you already have open in your repository will continue to target the old default branch (`master`). 8 | 9 | Fortunately, you can [change the base of an existing pull request](https://github.blog/2016-08-15-change-the-base-branch-of-a-pull-request/), but this is a one-at-a-time, manual operation. 10 | 11 | This utility will automate that, and make this change en masse. 12 | 13 | ## Setup 14 | 15 | 1. Ensure that you have [Node.js](https://nodejs.org/en/download/) installed. 16 | 2. Create a [personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) to use to authenticate. 17 | 18 | ## How to 19 | 20 | If you want to change the name of the default branch on GitHub: 21 | 22 | 1. Go to your project and make sure that you are on the current default branch (`master`). Open the branch picker, and type the name of the new branch (`main`). Select `Create branch: main from 'master'`. 23 | 24 | ![Create new branch](docs/newbranch.png) 25 | 26 | 2. Set this as the new default branch. Go to your project's settings, then select "Branches". Under "Default branch", open the branch picker and select the new default branch (`main`). 27 | 28 | ![Set the new default](docs/newdefault.png) 29 | 30 | 3. Update the existing pull requests. Specify your PAT with `--token`, your repository URL and the old and new branch names: 31 | 32 | ``` 33 | npx retarget_prs --token your_pat https://github.com/your/repo master main 34 | ``` 35 | 36 | ## Questions? 37 | 38 | Need help? [Open a GitHub issue](https://github.com/ethomson/retarget_prs). 39 | 40 | ## License 41 | 42 | Copyright (c), Edward Thomson. All rights reserved. 43 | 44 | Available under the MIT license, see the included [LICENSE.txt](LICENSE.txt) for details. 45 | -------------------------------------------------------------------------------- /docs/master_to_main.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethomson/retarget_prs/3b2ea82f7de064c2a18b546aecc4763db933f5af/docs/master_to_main.gif -------------------------------------------------------------------------------- /docs/newbranch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethomson/retarget_prs/3b2ea82f7de064c2a18b546aecc4763db933f5af/docs/newbranch.png -------------------------------------------------------------------------------- /docs/newdefault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ethomson/retarget_prs/3b2ea82f7de064c2a18b546aecc4763db933f5af/docs/newdefault.png -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | # 3 | # Batch update the base of all the pull requests in your GitHub repository 4 | # that are currently targeting a different branch. This is useful if you 5 | # want to change the name of your default branch, but you have pull 6 | # requests open. 7 | # 8 | # See also: 9 | # https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx 10 | 11 | const { Octokit } = require('@octokit/rest'); 12 | const minimist = require('minimist'); 13 | const pkginfo = require('pkginfo'); 14 | 15 | pkginfo(module, 'name', 'version'); 16 | 17 | const args = minimist(process.argv.slice(2), { 18 | alias: { 19 | t: 'token', 20 | v: 'verbose', 21 | h: 'help' 22 | }, 23 | string: [ 'token' ], 24 | boolean: [ 'dry-run', 'closed', 'verbose', 'debug', 'help' ], 25 | unknown: (arg) => { 26 | if (arg.startsWith('-')) { 27 | console.error(`${module.exports.name}: unknown option: ${arg}`); 28 | usage(console.error); 29 | process.exit(1); 30 | } 31 | }, 32 | }); 33 | 34 | (async function() { 35 | try { 36 | const token = args.token || process.env.GITHUB_TOKEN; 37 | 38 | const url = args._.shift(); 39 | const oldBranch = args._.shift(); 40 | const newBranch = args._.shift(); 41 | 42 | if (args.help) { 43 | help(); 44 | process.exit(0); 45 | } 46 | 47 | if (!url || !oldBranch || !newBranch) 48 | { 49 | console.log(`${module.exports.name}: repository, old branch and new branch must be specified.`); 50 | usage(console.error); 51 | process.exit(1); 52 | } 53 | 54 | if (!token) { 55 | console.error(`${module.exports.name}: no token was provided, specify --token or GITHUB_TOKEN`); 56 | usage(console.error); 57 | process.exit(1); 58 | } 59 | 60 | // I'm sorry; I used to write a lot of perl. 61 | if ((nwo = url.match(/^([^/]+)\/([^/]+)$/))) { 62 | owner = nwo[1]; 63 | repo = nwo[2]; 64 | } 65 | else if ((nwo = url.match(/^http(?:s)?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/]+)(?:\/)?$/i))) { 66 | owner = nwo[1]; 67 | repo = nwo[2]; 68 | } 69 | else { 70 | console.error(`${module.exports.name}: repository must be user/name format or a github.com URL`); 71 | console.error(` (example: 'https://github.com/foo/bar' or 'foo/bar')`); 72 | usage(console.error); 73 | process.exit(1); 74 | } 75 | 76 | if (args.debug) { 77 | args.verbose = true 78 | } 79 | 80 | const github = new Octokit({ 81 | auth: token.toString(), 82 | userAgent: `${module.exports.name}/${module.exports.version}`, 83 | log: args.debug ? console : undefined 84 | }); 85 | 86 | verbose(`Verifying that target branch '${newBranch}' exists...`); 87 | try { 88 | await github.repos.getBranch({ 89 | owner: owner, 90 | repo: repo, 91 | branch: newBranch 92 | }); 93 | } 94 | catch (e) { 95 | handle(e, `cannot retarget to '${newBranch}'`); 96 | } 97 | 98 | verbose(`Querying pull requests for ${repo}...`); 99 | let pulls = await queryPullRequests(github, owner, repo, oldBranch, args.closed); 100 | 101 | if (args.closed) { 102 | debug(`Filtering merged pull requests...`); 103 | pulls = pulls.filter((p) => p.state === 'open' || p.merged_at == undefined); 104 | } 105 | 106 | for (const pull of pulls) { 107 | verbose(`Updating pull request ${pull.number} from base '${oldBranch}' to '${newBranch}'...`); 108 | 109 | if (!args['dry-run']) { 110 | try { 111 | await github.pulls.update({ 112 | owner: owner, 113 | repo: repo, 114 | pull_number: pull.number, 115 | base: newBranch 116 | }); 117 | } 118 | catch (e) { 119 | handle(e, `could not update pull request ${pull.number}`); 120 | } 121 | } 122 | } 123 | } 124 | catch (e) { 125 | handle(e); 126 | } 127 | }()); 128 | 129 | async function queryPullRequests(github, owner, repo, base, closed) { 130 | const all = new Array(); 131 | let page = 1; 132 | 133 | try { 134 | while (true) { 135 | debug(`Querying page ${page} of pull requests...`); 136 | 137 | let results = await github.pulls.list({ 138 | owner: owner, 139 | repo: repo, 140 | state: closed ? 'all' : 'open', 141 | base: base, 142 | page: page 143 | }); 144 | 145 | if (results.data.length === 0) { 146 | break; 147 | } 148 | 149 | all.push(...results.data); 150 | page++; 151 | } 152 | } 153 | catch (e) { 154 | handle(e, 'could not query pull requests'); 155 | } 156 | 157 | return all; 158 | } 159 | 160 | function verbose(msg) { 161 | if (args.verbose) { 162 | console.log(msg); 163 | } 164 | } 165 | 166 | function debug(msg) { 167 | if (args.debug) { 168 | console.log(msg); 169 | } 170 | } 171 | 172 | function handle(e, msg) { 173 | console.error(`error: ${msg ? msg + ': ' : ''}${e.message}`); 174 | debug(e); 175 | process.exit(1); 176 | } 177 | 178 | function usage(dest = console.log) { 179 | dest(`usage: ${module.exports.name} [--token ] [--dry-run] [--closed] [--verbose]`); 180 | dest(` [--help] `); 181 | } 182 | 183 | function help(dest = console.log) { 184 | usage(dest); 185 | dest(``); 186 | dest(`OPTIONS`); 187 | dest(``); 188 | dest(` : The URL of the GitHub repository`); 189 | dest(` : The name of the old branch; pull requests targeting this`); 190 | dest(` base branch will be updated to refer to the .`); 191 | dest(` : The name of the new branch; pull requests will now be`); 192 | dest(` based on this branch. This branch must already exist.`); 193 | dest(` --token : The authentication token (PAT) to use when authenticating`); 194 | dest(` to the GitHub repository. If not specified, the`); 195 | dest(` environment variable GITHUB_TOKEN will be used.`); 196 | dest(` --dry-run: Do not make changes in the remote repository, only show`); 197 | dest(` the actions that would be taken.`); 198 | dest(` --closed: Also update closed (but unmerged) pull requests. By`); 199 | dest(` default, only open pull requests are updated.`); 200 | dest(` --verbose: Show verbose output.`); 201 | dest(` --help: Shows additional help.`); 202 | } 203 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "retarget_prs", 3 | "version": "0.1.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@octokit/auth-token": { 8 | "version": "2.4.1", 9 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.1.tgz", 10 | "integrity": "sha512-NB81O5h39KfHYGtgfWr2booRxp2bWOJoqbWwbyUg2hw6h35ArWYlAST5B3XwAkbdcx13yt84hFXyFP5X0QToWA==", 11 | "requires": { 12 | "@octokit/types": "^4.0.1" 13 | } 14 | }, 15 | "@octokit/core": { 16 | "version": "2.5.3", 17 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-2.5.3.tgz", 18 | "integrity": "sha512-23AHK9xBW0v79Ck8h5U+5iA4MW7aosqv+Yr6uZXolVGNzzHwryNH5wM386/6+etiKUTwLFZTqyMU9oQpIBZcFA==", 19 | "requires": { 20 | "@octokit/auth-token": "^2.4.0", 21 | "@octokit/graphql": "^4.3.1", 22 | "@octokit/request": "^5.4.0", 23 | "@octokit/types": "^4.0.1", 24 | "before-after-hook": "^2.1.0", 25 | "universal-user-agent": "^5.0.0" 26 | } 27 | }, 28 | "@octokit/endpoint": { 29 | "version": "6.0.2", 30 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.2.tgz", 31 | "integrity": "sha512-xs1mmCEZ2y4shXCpFjNq3UbmNR+bLzxtZim2L0zfEtj9R6O6kc4qLDvYw66hvO6lUsYzPTM5hMkltbuNAbRAcQ==", 32 | "requires": { 33 | "@octokit/types": "^4.0.1", 34 | "is-plain-object": "^3.0.0", 35 | "universal-user-agent": "^5.0.0" 36 | } 37 | }, 38 | "@octokit/graphql": { 39 | "version": "4.5.0", 40 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.0.tgz", 41 | "integrity": "sha512-StJWfn0M1QfhL3NKBz31e1TdDNZrHLLS57J2hin92SIfzlOVBuUaRkp31AGkGOAFOAVtyEX6ZiZcsjcJDjeb5g==", 42 | "requires": { 43 | "@octokit/request": "^5.3.0", 44 | "@octokit/types": "^4.0.1", 45 | "universal-user-agent": "^5.0.0" 46 | } 47 | }, 48 | "@octokit/plugin-paginate-rest": { 49 | "version": "2.2.1", 50 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.1.tgz", 51 | "integrity": "sha512-/tHpIF2XpN40AyhIq295YRjb4g7Q5eKob0qM3thYJ0Z+CgmNsWKM/fWse/SUR8+LdprP1O4ZzSKQE+71TCwK+w==", 52 | "requires": { 53 | "@octokit/types": "^4.0.1" 54 | } 55 | }, 56 | "@octokit/plugin-request-log": { 57 | "version": "1.0.0", 58 | "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz", 59 | "integrity": "sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw==" 60 | }, 61 | "@octokit/plugin-rest-endpoint-methods": { 62 | "version": "3.17.0", 63 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-3.17.0.tgz", 64 | "integrity": "sha512-NFV3vq7GgoO2TrkyBRUOwflkfTYkFKS0tLAPym7RNpkwLCttqShaEGjthOsPEEL+7LFcYv3mU24+F2yVd3npmg==", 65 | "requires": { 66 | "@octokit/types": "^4.1.6", 67 | "deprecation": "^2.3.1" 68 | } 69 | }, 70 | "@octokit/request": { 71 | "version": "5.4.4", 72 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.4.tgz", 73 | "integrity": "sha512-vqv1lz41c6VTxUvF9nM+a6U+vvP3vGk7drDpr0DVQg4zyqlOiKVrY17DLD6de5okj+YLHKcoqaUZTBtlNZ1BtQ==", 74 | "requires": { 75 | "@octokit/endpoint": "^6.0.1", 76 | "@octokit/request-error": "^2.0.0", 77 | "@octokit/types": "^4.0.1", 78 | "deprecation": "^2.0.0", 79 | "is-plain-object": "^3.0.0", 80 | "node-fetch": "^2.3.0", 81 | "once": "^1.4.0", 82 | "universal-user-agent": "^5.0.0" 83 | } 84 | }, 85 | "@octokit/request-error": { 86 | "version": "2.0.1", 87 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.1.tgz", 88 | "integrity": "sha512-5lqBDJ9/TOehK82VvomQ6zFiZjPeSom8fLkFVLuYL3sKiIb5RB8iN/lenLkY7oBmyQcGP7FBMGiIZTO8jufaRQ==", 89 | "requires": { 90 | "@octokit/types": "^4.0.1", 91 | "deprecation": "^2.0.0", 92 | "once": "^1.4.0" 93 | } 94 | }, 95 | "@octokit/rest": { 96 | "version": "17.11.0", 97 | "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-17.11.0.tgz", 98 | "integrity": "sha512-WqXmm37uCGP1NxYxSc27hd5pYNLdksuUsjR8vaNS8fCy6kyxZFy+Dbh/AzqKGj2mOdbnt7dILoGHfzsA4IIm4A==", 99 | "requires": { 100 | "@octokit/core": "^2.4.3", 101 | "@octokit/plugin-paginate-rest": "^2.2.0", 102 | "@octokit/plugin-request-log": "^1.0.0", 103 | "@octokit/plugin-rest-endpoint-methods": "3.17.0" 104 | } 105 | }, 106 | "@octokit/types": { 107 | "version": "4.1.9", 108 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-4.1.9.tgz", 109 | "integrity": "sha512-hinM/BA2c1vebN2HSR3JtVdYtrSbmvn/doUBZXXuQuh/9o60hYwitQQAGTpJu+k6pjtjURskDHQxUFvqLvYCeA==", 110 | "requires": { 111 | "@types/node": ">= 8" 112 | } 113 | }, 114 | "@types/node": { 115 | "version": "14.0.11", 116 | "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.11.tgz", 117 | "integrity": "sha512-lCvvI24L21ZVeIiyIUHZ5Oflv1hhHQ5E1S25IRlKIXaRkVgmXpJMI3wUJkmym2bTbCe+WoIibQnMVAU3FguaOg==" 118 | }, 119 | "before-after-hook": { 120 | "version": "2.1.0", 121 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", 122 | "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" 123 | }, 124 | "cross-spawn": { 125 | "version": "6.0.5", 126 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", 127 | "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", 128 | "requires": { 129 | "nice-try": "^1.0.4", 130 | "path-key": "^2.0.1", 131 | "semver": "^5.5.0", 132 | "shebang-command": "^1.2.0", 133 | "which": "^1.2.9" 134 | } 135 | }, 136 | "deprecation": { 137 | "version": "2.3.1", 138 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 139 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 140 | }, 141 | "end-of-stream": { 142 | "version": "1.4.4", 143 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 144 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 145 | "requires": { 146 | "once": "^1.4.0" 147 | } 148 | }, 149 | "execa": { 150 | "version": "1.0.0", 151 | "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", 152 | "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", 153 | "requires": { 154 | "cross-spawn": "^6.0.0", 155 | "get-stream": "^4.0.0", 156 | "is-stream": "^1.1.0", 157 | "npm-run-path": "^2.0.0", 158 | "p-finally": "^1.0.0", 159 | "signal-exit": "^3.0.0", 160 | "strip-eof": "^1.0.0" 161 | } 162 | }, 163 | "get-stream": { 164 | "version": "4.1.0", 165 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", 166 | "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", 167 | "requires": { 168 | "pump": "^3.0.0" 169 | } 170 | }, 171 | "is-plain-object": { 172 | "version": "3.0.0", 173 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", 174 | "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", 175 | "requires": { 176 | "isobject": "^4.0.0" 177 | } 178 | }, 179 | "is-stream": { 180 | "version": "1.1.0", 181 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", 182 | "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" 183 | }, 184 | "isexe": { 185 | "version": "2.0.0", 186 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 187 | "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" 188 | }, 189 | "isobject": { 190 | "version": "4.0.0", 191 | "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", 192 | "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==" 193 | }, 194 | "macos-release": { 195 | "version": "2.3.0", 196 | "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz", 197 | "integrity": "sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==" 198 | }, 199 | "minimist": { 200 | "version": "1.2.5", 201 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 202 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" 203 | }, 204 | "nice-try": { 205 | "version": "1.0.5", 206 | "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", 207 | "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" 208 | }, 209 | "node-fetch": { 210 | "version": "2.6.0", 211 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 212 | "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" 213 | }, 214 | "npm-run-path": { 215 | "version": "2.0.2", 216 | "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", 217 | "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", 218 | "requires": { 219 | "path-key": "^2.0.0" 220 | } 221 | }, 222 | "once": { 223 | "version": "1.4.0", 224 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 225 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 226 | "requires": { 227 | "wrappy": "1" 228 | } 229 | }, 230 | "os-name": { 231 | "version": "3.1.0", 232 | "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", 233 | "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", 234 | "requires": { 235 | "macos-release": "^2.2.0", 236 | "windows-release": "^3.1.0" 237 | } 238 | }, 239 | "p-finally": { 240 | "version": "1.0.0", 241 | "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", 242 | "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" 243 | }, 244 | "path-key": { 245 | "version": "2.0.1", 246 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", 247 | "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" 248 | }, 249 | "pkginfo": { 250 | "version": "0.4.1", 251 | "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", 252 | "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=" 253 | }, 254 | "pump": { 255 | "version": "3.0.0", 256 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 257 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 258 | "requires": { 259 | "end-of-stream": "^1.1.0", 260 | "once": "^1.3.1" 261 | } 262 | }, 263 | "semver": { 264 | "version": "5.7.1", 265 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", 266 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" 267 | }, 268 | "shebang-command": { 269 | "version": "1.2.0", 270 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", 271 | "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", 272 | "requires": { 273 | "shebang-regex": "^1.0.0" 274 | } 275 | }, 276 | "shebang-regex": { 277 | "version": "1.0.0", 278 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", 279 | "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" 280 | }, 281 | "signal-exit": { 282 | "version": "3.0.3", 283 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", 284 | "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" 285 | }, 286 | "strip-eof": { 287 | "version": "1.0.0", 288 | "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", 289 | "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" 290 | }, 291 | "universal-user-agent": { 292 | "version": "5.0.0", 293 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-5.0.0.tgz", 294 | "integrity": "sha512-B5TPtzZleXyPrUMKCpEHFmVhMN6EhmJYjG5PQna9s7mXeSqGTLap4OpqLl5FCEFUI3UBmllkETwKf/db66Y54Q==", 295 | "requires": { 296 | "os-name": "^3.1.0" 297 | } 298 | }, 299 | "which": { 300 | "version": "1.3.1", 301 | "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", 302 | "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", 303 | "requires": { 304 | "isexe": "^2.0.0" 305 | } 306 | }, 307 | "windows-release": { 308 | "version": "3.3.0", 309 | "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.3.0.tgz", 310 | "integrity": "sha512-2HetyTg1Y+R+rUgrKeUEhAG/ZuOmTrI1NBb3ZyAGQMYmOJjBBPe4MTodghRkmLJZHwkuPi02anbeGP+Zf401LQ==", 311 | "requires": { 312 | "execa": "^1.0.0" 313 | } 314 | }, 315 | "wrappy": { 316 | "version": "1.0.2", 317 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 318 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 319 | } 320 | } 321 | } 322 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "retarget_prs", 3 | "version": "0.1.1", 4 | "description": "Batch retarget GitHub pull requests onto a different base branch.", 5 | "main": "index.js", 6 | "bin": { 7 | "retarget_prs": "./index.js" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/ethomson/retarget_prs.git" 15 | }, 16 | "keywords": [ 17 | "GitHub", 18 | "Pull", 19 | "Request", 20 | "PRs" 21 | ], 22 | "author": "Edward Thomson ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/ethomson/retarget_prs/issues" 26 | }, 27 | "homepage": "https://github.com/ethomson/retarget_prs#readme", 28 | "dependencies": { 29 | "@octokit/rest": "^17.11.0", 30 | "minimist": "^1.2.5", 31 | "pkginfo": "^0.4.1" 32 | } 33 | } 34 | --------------------------------------------------------------------------------