Skip to content

Conversation

@addaleax
Copy link
Member

i.e. make get-metadata https://github.com/nodejs/node/pull/16489 work

bin/metadata.js Outdated
// Fast path: numeric string
if (`${+id}` === id)
return +id;
const match = id.match(/^https:.*\/([0-9]+)$/);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps try new URL(id), and fallback if it errors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, question: fall back to what? 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh... good point ;-) ... try new url.URL(id), check the protocol, and error if it's not a valid https URL

Copy link
Member

@joyeecheung joyeecheung Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a \/? at the end because sometimes people do paste the slash, like https://github.com/nodejs/node/pull/14782/(which breaks branch-diff from time to time..)...also maybe we can just make the regexp out of repo and owner? That way we can validate it's a pull instead of an issue as well (right now if it's an issue we just throw the errors around).

Copy link
Member

@joyeecheung joyeecheung Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah wait, we don't provide command line options for repo/owner right now :/ OK maybe just validate pull/([0-9])+\/? part..I know there are people in other repos using node-review so that should be a todo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup – I’ve added checks for pull/ and / or /files at the end :)

bin/metadata.js Outdated
const REPO = 'node';

const PR_ID = parseInt(process.argv[2]); // example
const PR_ID = parsePRId(process.argv[2]); // example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the // example comment can be removed now XD I added it when I chose 14782 as the default PR to test...I can do that later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! :)

bin/metadata.js Outdated
// Fast path: numeric string
if (`${+id}` === id)
return +id;
const match = id.match(/^https:.*\/([0-9]+)$/);
Copy link
Member

@joyeecheung joyeecheung Oct 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a \/? at the end because sometimes people do paste the slash, like https://github.com/nodejs/node/pull/14782/(which breaks branch-diff from time to time..)...also maybe we can just make the regexp out of repo and owner? That way we can validate it's a pull instead of an issue as well (right now if it's an issue we just throw the errors around).

Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I subconsciously opened ci.nodejs.org and...wait, we don't have test and we don't have CI yet, lol)

@joyeecheung joyeecheung merged commit 15a2c27 into nodejs:master Oct 26, 2017
@joyeecheung
Copy link
Member

I will just use the squash and merge button here...thanks!

@addaleax addaleax deleted the full-pr-url branch October 26, 2017 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants