-
-
Save WeslyG/a431e404f36bf424dea04938da58ba5d to your computer and use it in GitHub Desktop.
Предпоследний тег в гите. The penultimate tag in the git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// creatordate нужен потому что в тегах созданных на ранних версиях гита вполне себе может не быть коммитера! | |
const gitLastTag = execSync( | |
`git for-each-ref --count=10 --sort=-creatordate --format='%(refname:short)' refs/tags/release/engine/v*` | |
); | |
const lastReleaseTags = gitLastTag | |
.toString() | |
.split("\n") | |
.map(i => i.replace(/'|"/g, "")) | |
.filter(i => i !== "") | |
.filter(isReleaseTag); | |
if (lastReleaseTags[1] == undefined) { | |
throw Error(`penultimate tag not found in list ${JSON.stringify(lastReleaseTags)}`); | |
} | |
console.log(`Found penultimate tag = ${lastReleaseTags[1]}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment