8000 GitHub - dfberry1/octokit-commit-multiple-files: Octokit plugin to create/update multiple files at once
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dfberry1/octokit-commit-multiple-files

 
 

Repository files navigation

octokit-commit-multiple-files

This plugin is an alternative to using octokit.repos.createOrUpdateFile which allows you to edit the contents of a single file.

Installation

npm install octokit-commit-multiple-files --save

Usage

This plugin accepts owner, repo, path, branch and message like .createOrUpdateFile (Octokit Docs).

If the branch provided does not exist, the plugin will error. To automatically create it, set createBranch to true. You may provide a base branch if you choose to do this, or the plugin will use the repo's default branch as the base.

In addition, it accepts changes which is an array of objects containing a path and the file contents.

const Octokit = require("@octokit/rest").plugin(
  require("octokit-commit-multiple-files")
);
const octokit = new Octokit();

const branchName = await octokit.repos.createOrUpdateFiles({
  owner,
  repo,
  branch,
  createBranch,
  message,
  changes: [
    {
      path: "test.md",
      contents: "One"
    },
    {
      path: "test2.md",
      contents: "Two"
    }
  ]
})
< 4A24 /div>

About

Octokit plugin to create/update multiple files at once

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0