Always replace /head from branch

pull/353/head
Frostebite 2022-04-05 00:30:43 +01:00
parent 755df48342
commit 3ca6426707
4 changed files with 13 additions and 5 deletions

8
dist/index.js vendored
View File

@ -305,7 +305,7 @@ class BuildParameters {
preBuildSteps: input_1.default.preBuildSteps, preBuildSteps: input_1.default.preBuildSteps,
customJob: input_1.default.customJob, customJob: input_1.default.customJob,
runNumber: input_1.default.runNumber, runNumber: input_1.default.runNumber,
branch: input_1.default.branch || (yield git_repo_1.GitRepoReader.GetBranch()), branch: input_1.default.branch.replace('/head', '') || (yield git_repo_1.GitRepoReader.GetBranch()),
cloudRunnerBranch: input_1.default.cloudRunnerBranch.split('/').reverse()[0], cloudRunnerBranch: input_1.default.cloudRunnerBranch.split('/').reverse()[0],
cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests, cloudRunnerIntegrationTests: input_1.default.cloudRunnerTests,
githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder', githubRepo: input_1.default.githubRepo || (yield git_repo_1.GitRepoReader.GetRemote()) || 'game-ci/unity-builder',
@ -3846,7 +3846,11 @@ class GitRepoReader {
static GetBranch() { static GetBranch() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
console_1.assert(fs_1.default.existsSync(`.git`)); console_1.assert(fs_1.default.existsSync(`.git`));
return (yield system_1.default.run(`git branch`, [], {}, false)).split('*')[1].split(`\n`)[0].replace(/ /g, ``); return (yield system_1.default.run(`git branch`, [], {}, false))
.split('*')[1]
.split(`\n`)[0]
.replace(/ /g, ``)
.replace('/head', '');
}); });
} }
} }

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -131,7 +131,7 @@ class BuildParameters {
preBuildSteps: Input.preBuildSteps, preBuildSteps: Input.preBuildSteps,
customJob: Input.customJob, customJob: Input.customJob,
runNumber: Input.runNumber, runNumber: Input.runNumber,
branch: Input.branch || (await GitRepoReader.GetBranch()), branch: Input.branch.replace('/head', '') || (await GitRepoReader.GetBranch()),
cloudRunnerBranch: Input.cloudRunnerBranch.split('/').reverse()[0], cloudRunnerBranch: Input.cloudRunnerBranch.split('/').reverse()[0],
cloudRunnerIntegrationTests: Input.cloudRunnerTests, cloudRunnerIntegrationTests: Input.cloudRunnerTests,
githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder', githubRepo: Input.githubRepo || (await GitRepoReader.GetRemote()) || 'game-ci/unity-builder',

View File

@ -13,6 +13,10 @@ export class GitRepoReader {
public static async GetBranch() { public static async GetBranch() {
assert(fs.existsSync(`.git`)); assert(fs.existsSync(`.git`));
return (await System.run(`git branch`, [], {}, false)).split('*')[1].split(`\n`)[0].replace(/ /g, ``); return (await System.run(`git branch`, [], {}, false))
.split('*')[1]
.split(`\n`)[0]
.replace(/ /g, ``)
.replace('/head', '');
} }
} }