Skip to content

Commit 65b78ad

Browse files
committed
fix: Try to use args before git
1 parent e9cfaf5 commit 65b78ad

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/ci_providers/provider_local.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ function _getBuildURL(inputs) {
1717

1818
function _getBranch(inputs) {
1919
const { args } = inputs
20+
if (args.branch) {
21+
return args.branch
22+
}
2023
try {
2124
const branchName = childprocess
2225
.spawnSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'])
2326
.stdout.toString()
2427
.trimRight()
25-
return args.branch || branchName
28+
return branchName
2629
} catch (error) {
2730
throw new Error(
2831
`There was an error getting the branch name from git: ${error}`,
@@ -53,12 +56,15 @@ function getServiceName() {
5356

5457
function _getSHA(inputs) {
5558
const { args } = inputs
59+
if (args.sha) {
60+
return args.sha
61+
}
5662
try {
5763
const sha = childprocess
5864
.spawnSync('git', ['rev-parse', 'HEAD'])
5965
.stdout.toString()
6066
.trimRight()
61-
return args.sha || sha
67+
return sha
6268
} catch (error) {
6369
throw new Error(
6470
`There was an error getting the commit SHA from git: ${error}`,
@@ -68,12 +74,15 @@ function _getSHA(inputs) {
6874

6975
function _getSlug(inputs) {
7076
const { args } = inputs
77+
if (args.slug) {
78+
return args.slug
79+
}
7180
try {
7281
const slug = childprocess
7382
.spawnSync('git', ['config', '--get', 'remote.origin.url'])
7483
.stdout.toString()
7584
.trimRight()
76-
return args.slug || parseSlug(slug)
85+
return parseSlug(slug)
7786
} catch (error) {
7887
throw new Error(`There was an error getting the slug from git: ${error}`)
7988
}

0 commit comments

Comments
 (0)