Package Exports
- @octokit/plugin-enterprise-compatibility
- @octokit/plugin-enterprise-compatibility/dist-node/index.js
- @octokit/plugin-enterprise-compatibility/dist-src/index.js
- @octokit/plugin-enterprise-compatibility/dist-web/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@octokit/plugin-enterprise-compatibility) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
plugin-enterprise-compatibility.js
Octokit plugin for improving GHE compatibility
The GitHub API teams is continuously improving existing APIs to make the overall platform more consistent. For example, the Add labels to an issue expected the label names array to be sent directly in the request body root, as you can still see in the documentation for GHE 2.15.
While consistency is great, changing like the above makes the current octokit.issues.addLabels()
incompatible with GHE v2.15 and older. If you require compatibility with GHE versions, you can use the Enterprise rest plugin, but that will remove new endpoint methods that are not available on Enterprise yet.
As a compromise, this plugin is reverting changes such as the one above to remain compatible with currently supported GitHub enterprise versions.
Usage
Browsers |
Load <script type="module">
import { Octokit } from "https://esm.sh/@octokit/core";
import { enterpriseCompatibility } from "https://esm.sh/@octokit/plugin-enterprise-compatibility";
</script> |
---|---|
Node |
Install with const { Octokit } = require("@octokit/core");
const {
enterpriseCompatibility,
} = require("@octokit/plugin-enterprise-compatibility"); |
const MyOctokit = Octokit.plugin(enterpriseCompatibility);
const octokit = new MyOctokit({
auth: "token123",
});
octokit.request("POST /repos/{owner}/{repo}/issues/{issue_number}/labels", {
owner,
repo,
number,
labels: ["foo", "bar"],
});
// sends ["foo", "bar"] instead of {"labels":["foo", "bar"]} as request body