-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds `yarn gh:pr` to help auto open and properly format PRs for adding new GIFs
- Loading branch information
1 parent
f09cc2c
commit 87693a5
Showing
6 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
No user data is contained within this folder. The contents of this folder can safely be deleted when upgrading/downgrading the module. |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const util = require('util'); | ||
const exec = util.promisify(require('child_process').exec); | ||
|
||
async function run() { | ||
const r = new RegExp(/(\+ "url": "|",\n)/gm); | ||
const { stdout: rawGIFLines } = await exec(`git diff master... gifs.json | grep '+ "url": '`); | ||
const newGIFLinks = rawGIFLines.replace(r, '').split('+ url: '); | ||
console.log('Writing PR body with new GIFs: ', newGIFLinks); | ||
const formattedGIFMarkDown = newGIFLinks.map((gifURL) => `![New GIF](${gifURL})\n`); | ||
const { stdout: branch } = await exec('git branch --show-current'); | ||
console.log('Pushing changes to remote\n'); | ||
await exec(`git push origin -u ${branch}`); | ||
console.log('Remote received changes\n'); | ||
console.log('Opening new PR\n'); | ||
const { stdout: message } = await exec( | ||
`gh pr create --title 'Adding More Gifs' --body '## Added GIFs \n\n ${formattedGIFMarkDown}'` | ||
); | ||
console.log(`New PR opened @ ${message.replace('\n', '')}`); | ||
} | ||
|
||
run(); |