Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ng-dev): merge tool accidentally performing unauthenticated Github requests #228

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

devversion
Copy link
Member

The merge tool accidentally performs unauthenticated Github API
requests. This started happening when we refactored some things
in the merge tool.

We should not rely on default values for parameters as explicit
parameters encourage thinking about passing the potentially needed
/already-existing values (like for the authenctiated git client).

This commit changes this in all places of the merge tool and
release tool in order to ensure we always use the correct
instance of the Git client (as initially configured).

Note: We could theoretically have a method that returns a git
client singleton, prioritizing the authenticated one. Though I
personally still believe that being explicit is better and encouraging
thinking of function consumers.

RequestError [HttpError]: API rate limit exceeded for <ip>. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
  at /usr/local/google/home/wagnermaciel/Documents/angular/components/node_modules/@octokit/request/dist-src/fetch-wrapper.js:68:27
  at processTicksAndRejections (internal/process/task_queues.js:95:5)
  at async getVersionOfBranch (/usr/local/google/home/wagnermaciel/Documents/angular/components/ng-dev/release/versioning/version-branches.ts:51:18)
  at async fetchActiveReleaseTrains (/usr/local/google/home/wagnermaciel/Documents/angular/components/ng-dev/release/versioning/active-release-trains.ts:34:23)
  at async getTargetLabelsForActiveReleaseTrains (/usr/local/google/home/wagnermaciel/Documents/angular/components/ng-dev/pr/merge/defaults/labels.ts:54:44)
  at async getTargetBranchesForPullRequest (/usr/local/google/home/wagnermaciel/Documents/angular/components/ng-dev/pr/merge/target-label.ts:112:26)
  at async loadAndValidatePullRequest (/usr/local/google/home/wagnermaciel/Documents/angular/components/ng-dev/pr/merge/pull-request.ts:73:26)
  at async PullRequestMergeTask.merge 

…b requests

The merge tool accidentally performs unauthenticated Github API
requests. This started happening when we refactored some things
in the merge tool.

We should not rely on default values for parameters as explicit
parameters encourage thinking about passing the potentially needed
/already-existing values (like for the authenctiated git client).

This commit changes this in all places of the merge tool and
release tool in order to ensure we always use the correct
instance of the Git client (as initially configured).

Note: We could theoretically have a method that returns a git
client singleton, priortizing the authenticated one. Though I
personally still believe that being explicit is better and encouraging
thinking of function consumers.
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@devversion devversion merged commit faae17f into angular:main Sep 16, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants