Last active
August 4, 2021 05:14
-
-
Save psealock/cd8c60ec34f776c4bf0f88a3aa7a3537 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Usage: node ./transfer.js <destination repo> | |
* Run from the root of source repo. | |
* Requires `hub` | |
*/ | |
const { exec } = require( 'child_process' ); | |
const destinationRepo = process.argv[ 2 ]; | |
exec( 'hub issue', ( error, stdout ) => { | |
if ( error !== null ) { | |
console.log( `exec error: ${ error }` ); | |
} | |
const rx = /(?<=#)\d+/gm; | |
const issueNumbers = stdout | |
.match( rx ) | |
.map( ( str ) => parseInt( str, 10 ) ); | |
issueNumbers.forEach( ( issueNumber ) => { | |
exec( | |
`hub issue transfer ${ issueNumber } ${ destinationRepo }`, | |
( transferError, transferOut, transferErr ) => { | |
if ( transferError !== null ) { | |
console.log( `exec error: ${ transferError }` ); | |
} | |
if ( transferErr ) { | |
console.log( transferErr ); | |
} | |
if ( transferOut ) { | |
console.log( 'Issue transfered: ' + transferOut ); | |
} | |
} | |
); | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment