Skip to content

Instantly share code, notes, and snippets.

@vernetto
Created October 14, 2023 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vernetto/ecd556e7f7043064995537a008623c4c to your computer and use it in GitHub Desktop.
Save vernetto/ecd556e7f7043064995537a008623c4c to your computer and use it in GitHub Desktop.
git
const { execSync } = require('child_process');
const versionPrefix = 'v23.11.03'; // Replace this with your desired prefix
try {
const latestTag = execSync(`git describe --tags --abbrev=0 --match "${versionPrefix}.[0-9]*" 2>/dev/null || true`, { encoding: 'utf-8' });
console.log('Latest tag:', latestTag.trim());
} catch (error) {
// Handle the error here if needed
console.error('Error:', error.message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment