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)
- Host: GitHub
- URL: https://github.com/gr2m/octokit-plugin-get-semantic-releases
- Owner: gr2m
- License: mit
- Created: 2022-02-11T17:02:04.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-23T19:41:28.000Z (almost 4 years ago)
- Last Synced: 2025-04-11T15:10:06.938Z (about 1 year ago)
- Language: TypeScript
- Size: 30.3 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
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)
[](https://www.npmjs.com/package/octokit-plugin-get-semantic-releases)
[](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)