octokit-plugin-get-semantic-releases
Get repository releases with semantic version tags (e.g.
v1.2.3
,v2.0.0-beta.1
, etc)
usage
Browsers |
Load <script type="module">
import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
import {
getSemanticReleases,
composeGetSemanticReleases,
} from "https://cdn.skypack.dev/octokit-plugin-get-semantic-releases";
</script> |
---|---|
Node |
Install with const { Octokit } = require("@octokit/core");
const {
getSemanticReleases,
composeGetSemanticReleases,
} = require("octokit-plugin-get-semantic-releases"); |
const MyOctokit = Octokit.plugin(getSemanticReleases);
const octokit = new MyOctokit({ auth: "secret123" });
const releases = await octokit.getSemanticReleases({
owner: "octokit",
repo: "core.js",
});
// `releases` is array of releases as shown at https://docs.github.com/en/rest/reference/releases#list-releases
// but includes a `version` property, which is the normalized semantic version derived from the tag name.
// The releases are sorted by version in ascending order.
If you want to utilize the getSemanticReleases()
in another plugin or with an existing octokit
instance, use composeGetSemanticReleases
.
function myPlugin(octokit, options) {
return {
myMethod({owner, repo}) => {
return composeGetSemanticReleases(
octokit,
{owner, repo }
)
}
}
}
Options
name | type | description |
---|---|---|
owner
|
string
|
Required. Repository owner login |
repo
|
string
|
Required. Repository name |
range
|
string
|
Filter out versions that don't match the Example: Load all stable versions greater than const releases = await octokit.getSemanticReleases({
owner: "octokit",
repo: "core.js",
range: ">1.2.1",
}); |
Contributing
See CONTRIBUTING.md