version-info: return git branch info correctly in cf workers

This commit is contained in:
wukko 2025-06-28 19:06:21 +06:00
parent bd0caac5ba
commit a751f81ea3
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2
2 changed files with 5 additions and 1 deletions

View File

@ -39,6 +39,10 @@ export const getBranch = async () => {
return process.env.CF_PAGES_BRANCH;
}
if (process.env.WORKERS_CI_BRANCH) {
return process.env.WORKERS_CI_BRANCH;
}
return (await readGit('.git/HEAD'))
?.replace(/^ref: refs\/heads\//, '')
?.trim();

View File

@ -1,6 +1,6 @@
{
"name": "@imput/version-info",
"version": "1.0.0",
"version": "1.0.1",
"description": "helper package for cobalt that provides commit info & version from package file.",
"main": "index.js",
"types": "index.d.ts",