An open API service indexing awesome lists of open source software.

https://github.com/gr2m/octokit-plugin-get-semantic-releases

Get repository releases with semantic version tags (e.g. `v1.2.3`, `v2.0.0-beta.1`, etc)
https://github.com/gr2m/octokit-plugin-get-semantic-releases

Last synced: about 1 year ago
JSON representation

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

Awesome Lists containing this project

README

          

# octokit-plugin-get-semantic-releases

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

[![@latest](https://img.shields.io/npm/v/octokit-plugin-get-semantic-releases.svg)](https://www.npmjs.com/package/octokit-plugin-get-semantic-releases)
[![Build Status](https://github.com/gr2m/octokit-plugin-get-semantic-releases/workflows/Test/badge.svg)](https://github.com/gr2m/octokit-plugin-get-semantic-releases/actions?query=workflow%3ATest+branch%3Amain)

## usage

Browsers

Load `octokit-plugin-get-semantic-releases` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.skypack.dev](https://cdn.skypack.dev)

```html

import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
import {
getSemanticReleases,
composeGetSemanticReleases,
} from "https://cdn.skypack.dev/octokit-plugin-get-semantic-releases";

```

Node

Install with `npm install @octokit/core octokit-plugin-get-semantic-releases`. Optionally replace `@octokit/core` with a compatible module

```js
const { Octokit } = require("@octokit/core");
const {
getSemanticReleases,
composeGetSemanticReleases,
} = require("octokit-plugin-get-semantic-releases");
```

```js
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`.

```js
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](https://semver.npmjs.com/).

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

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



## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)

## License

[MIT](LICENSE)