https://github.com/anshsinghsonkhia/github-version-fetcher
NPM Package to fetch all semantically versioned tags of a GitHub repository using your own GitHub API token.
https://github.com/anshsinghsonkhia/github-version-fetcher
npm-package
Last synced: 7 months ago
JSON representation
NPM Package to fetch all semantically versioned tags of a GitHub repository using your own GitHub API token.
- Host: GitHub
- URL: https://github.com/anshsinghsonkhia/github-version-fetcher
- Owner: AnshSinghSonkhia
- Created: 2025-03-17T13:32:26.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-03-17T14:21:00.000Z (7 months ago)
- Last Synced: 2025-03-17T14:32:14.574Z (7 months ago)
- Topics: npm-package
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/github-version-fetcher
- Size: 0 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# github-version-fetcher
Fetch all semantically versioned tags of a GitHub repository using your own GitHub API token.
# Features
✅ Fetches **release tags** from a GitHub repo.
✅ Filters **only semantic versions** (e.g., `v1.2.3`).
✅ Returns sorted versions **from latest to oldest**.
✅ Uses **GitHub API v3** for fetching data.# Installation
```shell
npm i github-version-fetcher
```# Importing
### Importing in CommonJS (Node.js Default)
```js
const getVersions = require('github-version-fetcher');
```### Importing in ES Modules (ECMAScript Imports)
```js
import getVersions from 'github-version-fetcher';
```# Usage
```js
// Replace with your GitHub Personal Access Token
const GITHUB_TOKEN = 'your_personal_access_token';(async () => {
try {
const versions = await getVersions('github-username/repo-name', GITHUB_TOKEN);
console.log('Versions:', versions);
} catch (error) {
console.error('Error fetching versions:', error);
}
})();```
## Example Usage
```js
// Replace with your GitHub Personal Access Token
const GITHUB_TOKEN = 'your_personal_access_token';(async () => {
try {
const versions = await getVersions('facebook/react', GITHUB_TOKEN);
console.log('Versions:', versions);
} catch (error) {
console.error('Error fetching versions:', error);
}
})();```
# GitHub Authentication
GitHub limits API requests for unauthenticated users. To prevent failures, use a GitHub Personal Access Token (PAT).### How to Get a GitHub Token?
- Go to [GitHub Developer Settings](https://github.com/settings/tokens)
- Click "Generate new token (classic)".
- Select public_repo scope.
- Copy the token and use it in your code.