npm

octokit-plugin-get-semantic-releases
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

octokit-plugin-get-semantic-releases

Get repository releases with semantic version tags (e.g. v1.2.3, v2.0.0-beta.1, etc)

@latest Build Status

usage

Browsers

Load octokit-plugin-get-semantic-releases and @octokit/core (or core-compatible module) directly from cdn.skypack.dev

<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 npm install @octokit/core octokit-plugin-get-semantic-releases. Optionally replace @octokit/core with a compatible module

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 range string following semver conventions.

Example: Load all stable versions greater than v1.2.1 but not inclusive.

const releases = await octokit.getSemanticReleases({
  owner: "octokit",
  repo: "core.js",
  range: ">1.2.1",
});

Contributing

See CONTRIBUTING.md

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i octokit-plugin-get-semantic-releases

Weekly Downloads

2

Version

2.0.0

License

MIT

Unpacked Size

25.6 kB

Total Files

15

Last publish

Collaborators

  • gr2m