Skip to content

Conversation

@LiviaMedeiros
Copy link
Member

Having to fill pr-url in docs is sometimes annoying, since there's no guaranteed way to predict the PR number before pushing the changes.
This PR adds tool that searches for https://github.com/nodejs/node/pull/FILLME and posts https://github.com/nodejs/node/pull/12345 (where 12345 is actual PR number) as code review suggestion (```suggestion).
To avoid unnecessary flooding, it triggers only on initial open, and only if pr-url was explicitly set as https://github.com/nodejs/node/pull/FILLME in the files.

This also could be addressed as local tool, or even as ncu feature (e.g. git node i-feel-lucky to guess the next number, fill and commit).

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory. labels Jan 1, 2026
Comment on lines 28 to 29
REPO: ${{ github.repository }}
SHA: ${{ github.sha }}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use $GITHUB_REPOSITORY and $GITHUB_SHA that are already defined (see https://docs.github.com/en/actions/reference/workflows-and-actions/variables#default-environment-variables)


// https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
await fetch(
new URL(`repos/${REPO}/pulls/${PR_NUMBER}/reviews`, 'https://api.github.com'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
new URL(`repos/${REPO}/pulls/${PR_NUMBER}/reviews`, 'https://api.github.com'),
new URL(`repos/${REPO}/pulls/${PR_NUMBER}/reviews`, process.env.GITHUB_API_URL || 'https://api.github.com'),

Comment on lines 27 to 30
const res = await fetch(
new URL(`repos/${REPO}/pulls/${PR_NUMBER}/files`, 'https://api.github.com'),
{ headers },
);
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to use octokit here, rather than manually interacting with the API?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm fine with either way, by default manual requests should have slightly less overhead. Are there benefits from using octikit here?

LiviaMedeiros and others added 2 commits January 2, 2026 17:57
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants