Skip to content

Commit ffee2bd

Browse files
authored
Move git revision to a separate function (#399)
1 parent c5dbca1 commit ffee2bd

File tree

1 file changed

+8
-5
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+8
-5
lines changed

packages/bundler-plugin-core/src/utils.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,20 @@ export function stringToUUID(str: string): string {
194194
).toLowerCase();
195195
}
196196

197-
/**
198-
* Tries to guess a release name based on environmental data.
199-
*/
200-
export function determineReleaseName(): string | undefined {
197+
function gitRevision(): string | undefined {
201198
let gitRevision: string | undefined;
202199
try {
203200
gitRevision = childProcess.execSync("git rev-parse HEAD").toString().trim();
204201
} catch (e) {
205202
// noop
206203
}
204+
return gitRevision;
205+
}
207206

207+
/**
208+
* Tries to guess a release name based on environmental data.
209+
*/
210+
export function determineReleaseName(): string | undefined {
208211
return (
209212
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
210213
process.env["GITHUB_SHA"] ||
@@ -225,7 +228,7 @@ export function determineReleaseName(): string | undefined {
225228
process.env["ZEIT_GITHUB_COMMIT_SHA"] ||
226229
process.env["ZEIT_GITLAB_COMMIT_SHA"] ||
227230
process.env["ZEIT_BITBUCKET_COMMIT_SHA"] ||
228-
gitRevision
231+
gitRevision()
229232
);
230233
}
231234

0 commit comments

Comments
 (0)