Skip to content

Move createOrUpdateFiles to the root object #111

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

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Octokit = Octokit.plugin(require("octokit-commit-multiple-files"));

const octokit = new Octokit();

const commits = await octokit.rest.repos.createOrUpdateFiles({
const commits = await octokit.createOrUpdateFiles({
owner,
repo,
branch,
Expand Down Expand Up @@ -52,7 +52,7 @@ I hope it works`,
If you want to upload non-text data, you can `base64`` encode the content and provide that as the value. Here's an example that would upload a small GitHub icon to a repository:

```javascript
const commits = await octokit.rest.repos.createOrUpdateFiles({
const commits = await octokit.createOrUpdateFiles({
owner,
repo,
branch,
Expand Down
2 changes: 1 addition & 1 deletion create-or-update-files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ test("failure (fileToDelete is missing)", async () => {
test("Loads plugin", () => {
const TestOctokit = Octokit.plugin(require("."));
const testOctokit = new TestOctokit();
expect(testOctokit).toHaveProperty("rest.repos.createOrUpdateFiles");
expect(testOctokit).toHaveProperty("createOrUpdateFiles");
});

test("Does not overwrite other methods", () => {
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const plugin = require("./create-or-update-files");

module.exports = function (octokit) {
octokit.rest.repos.createOrUpdateFiles = plugin.bind(null, octokit);
return {
createOrUpdateFiles: plugin.bind(null, octokit),
};
};