gr2m / octokit-plugin-create-pull-request

Octokit plugin to create a pull request with multiple file changes
MIT License
104 stars 28 forks source link

fix: avoid creating blobs for UTF-8 text files #133

Closed rmartine-ias closed 1 year ago

rmartine-ias commented 1 year ago

To open a pull request using GitHub's API, it's necessary to create a tree, where you can either specify file contents as a string, or the hash of a blob that's already been pushed to GitHub. Creating blobs requires an API call, while specifying file contents does not. GitHub has a low secondary rate limit for creating blobs.

This PR makes it so fewer files are sent as binary blobs. UTF-8 files do not need to be sent up as blobs, they can be included in the tree as their literal contents.

The fixture update is a bit of a mess but I'm not sure if I can do it better.

See also: https://github.com/gr2m/octokit-plugin-create-pull-request/issues/121

gr2m commented 1 year ago

GitHub has a low secondary rate limit for creating blobs

How do you know? I'm not aware this is the case

rmartine-ias commented 1 year ago

GitHub has a low secondary rate limit for creating blobs

How do you know? I'm not aware this is the case

Experience, I looked for docs on the secondary rate limits but didn't find anything concrete. Others are also unable to find documentation. The secondary limit doesn't appear to be returned in headers, either -- tested with an app and user token :/

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 5.1.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: