Skip to content

Commit 8770462

Browse files
more refactoring
1 parent 152dd99 commit 8770462

3 files changed

Lines changed: 38 additions & 39 deletions

File tree

dist/index.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59575,8 +59575,7 @@ async function execXcRun(args) {
5957559575
}
5957659576
},
5957759577
silent: !core.isDebug(),
59578-
ignoreReturnCode: true,
59579-
failOnStdErr: true
59578+
ignoreReturnCode: true
5958059579
});
5958159580
}
5958259581
finally {
@@ -59589,14 +59588,14 @@ async function execXcRun(args) {
5958959588
if (!core.isDebug()) {
5959059589
core.endGroup();
5959159590
}
59592-
}
59593-
if (isJsonOutput) {
59594-
const jsonMatch = output.match(/\{[\s\S]*\}/);
59595-
if (jsonMatch) {
59596-
try {
59597-
output = JSON.stringify(JSON.parse(jsonMatch[0]), null, 2);
59598-
}
59599-
catch (error) {
59591+
if (isJsonOutput) {
59592+
const jsonMatch = output.match(/\{[\s\S]*\}/);
59593+
if (jsonMatch) {
59594+
try {
59595+
output = JSON.stringify(JSON.parse(jsonMatch[0]), null, 2);
59596+
}
59597+
catch (error) {
59598+
}
5960059599
}
5960159600
}
5960259601
}
@@ -59609,10 +59608,11 @@ async function execXcRun(args) {
5960959608
async function execGit(args) {
5961059609
let exitCode = 1;
5961159610
let output = '';
59611+
if (!core.isDebug()) {
59612+
core.info(`[command]git ${args.join(' ')}`);
59613+
core.startGroup(`git ${args.join(' ')}`);
59614+
}
5961259615
try {
59613-
if (!core.isDebug()) {
59614-
core.startGroup(`[command]git ${args.join(' ')}`);
59615-
}
5961659616
exitCode = await (0, exec_1.exec)('git', args, {
5961759617
listeners: {
5961859618
stdout: (data) => {
@@ -59627,16 +59627,16 @@ async function execGit(args) {
5962759627
silent: !core.isDebug(),
5962859628
ignoreReturnCode: true
5962959629
});
59630-
if (exitCode > 0) {
59631-
(0, utilities_1.log)(output, 'error');
59632-
throw new Error(`Git failed with exit code: ${exitCode}`);
59633-
}
5963459630
}
5963559631
finally {
5963659632
if (!core.isDebug()) {
5963759633
core.endGroup();
5963859634
}
5963959635
}
59636+
if (exitCode > 0) {
59637+
(0, utilities_1.log)(output, 'error');
59638+
throw new Error(`Git failed with exit code: ${exitCode}`);
59639+
}
5964059640
return output;
5964159641
}
5964259642

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/xcode.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,7 @@ async function execXcRun(args: string[]): Promise<string> {
13301330
}
13311331
},
13321332
silent: !core.isDebug(),
1333-
ignoreReturnCode: true,
1334-
failOnStdErr: true
1333+
ignoreReturnCode: true
13351334
});
13361335
} finally {
13371336
// process any remaining partial line
@@ -1346,17 +1345,17 @@ async function execXcRun(args: string[]): Promise<string> {
13461345
if (!core.isDebug()) {
13471346
core.endGroup();
13481347
}
1349-
}
13501348

1351-
if (isJsonOutput) { // pretty print json output
1352-
// Use regex to extract the first JSON object from the output
1353-
const jsonMatch = output.match(/\{[\s\S]*\}/);
1349+
if (isJsonOutput) { // pretty print json output
1350+
// Use regex to extract the first JSON object from the output
1351+
const jsonMatch = output.match(/\{[\s\S]*\}/);
13541352

1355-
if (jsonMatch) {
1356-
try {
1357-
output = JSON.stringify(JSON.parse(jsonMatch[0]), null, 2);
1358-
} catch (error) {
1359-
// If JSON parsing fails, keep the original output
1353+
if (jsonMatch) {
1354+
try {
1355+
output = JSON.stringify(JSON.parse(jsonMatch[0]), null, 2);
1356+
} catch (error) {
1357+
// If JSON parsing fails, keep the original output
1358+
}
13601359
}
13611360
}
13621361
}
@@ -1373,12 +1372,12 @@ async function execGit(args: string[]): Promise<string> {
13731372
let exitCode: number = 1;
13741373
let output: string = '';
13751374

1376-
try {
1377-
1378-
if (!core.isDebug()) {
1379-
core.startGroup(`[command]git ${args.join(' ')}`);
1380-
}
1375+
if (!core.isDebug()) {
1376+
core.info(`[command]git ${args.join(' ')}`);
1377+
core.startGroup(`git ${args.join(' ')}`);
1378+
}
13811379

1380+
try {
13821381
exitCode = await exec('git', args, {
13831382
listeners: {
13841383
stdout: (data: Buffer) => {
@@ -1393,16 +1392,16 @@ async function execGit(args: string[]): Promise<string> {
13931392
silent: !core.isDebug(),
13941393
ignoreReturnCode: true
13951394
});
1396-
1397-
if (exitCode > 0) {
1398-
log(output, 'error');
1399-
throw new Error(`Git failed with exit code: ${exitCode}`);
1400-
}
14011395
} finally {
14021396
if (!core.isDebug()) {
14031397
core.endGroup();
14041398
}
14051399
}
14061400

1401+
if (exitCode > 0) {
1402+
log(output, 'error');
1403+
throw new Error(`Git failed with exit code: ${exitCode}`);
1404+
}
1405+
14071406
return output;
14081407
}

0 commit comments

Comments
 (0)