Skip to content

Commit 1f013a2

Browse files
feat: [SIGINT-2798] Add mark_build_status support and return status code from the action.
Added support for marking build status as ‘success', or 'failure' in the Black Duck Security Scan. Improved error handling and ensured the correct status code is returned from the action. Refs: [SIGINT-2798], [INTEGRATE-169]
1 parent 298eb6b commit 1f013a2

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

dist/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,15 +2764,8 @@ function run() {
27642764
}
27652765
// Execute bridge command
27662766
exitCode = yield sb.executeBridgeCommand(formattedCommand, (0, config_1.getGitHubWorkspaceDir)());
2767-
const taskResult = (0, utility_1.checkJobResult)(inputs.MARK_BUILD_STATUS);
2768-
if (exitCode === 0) {
2769-
(0, core_1.info)('Black Duck Security Action workflow execution completed.');
2770-
isBridgeExecuted = true;
2771-
}
2772-
else if (exitCode === 8 && taskResult === constants.BUILD_STATUS.SUCCESS) {
2773-
(0, core_1.info)('Marking the build ${taskResult} as configured in the task');
2774-
isBridgeExecuted = true;
2775-
}
2767+
isBridgeExecuted = exitCode === 0 || (exitCode === 8 && (0, utility_1.checkJobResult)(inputs.MARK_BUILD_STATUS) === constants.BUILD_STATUS.SUCCESS);
2768+
(0, core_1.info)(exitCode === 8 && isBridgeExecuted ? `Marking the build ${inputs.MARK_BUILD_STATUS} as configured in the task.` : 'Black Duck Security Action workflow execution completed successfully.');
27762769
return exitCode;
27772770
}
27782771
catch (error) {

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/main.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ export async function run() {
2828
}
2929
// Execute bridge command
3030
exitCode = await sb.executeBridgeCommand(formattedCommand, getGitHubWorkspaceDirV2())
31-
const taskResult: string | undefined = checkJobResult(inputs.MARK_BUILD_STATUS)
32-
if (exitCode === 0) {
33-
info('Black Duck Security Action workflow execution completed.')
34-
isBridgeExecuted = true
35-
} else if (exitCode === 8 && taskResult === constants.BUILD_STATUS.SUCCESS) {
36-
info('Marking the build ${taskResult} as configured in the task')
37-
isBridgeExecuted = true
38-
}
31+
isBridgeExecuted = exitCode === 0 || (exitCode === 8 && checkJobResult(inputs.MARK_BUILD_STATUS) === constants.BUILD_STATUS.SUCCESS)
32+
info(exitCode === 8 && isBridgeExecuted ? `Marking the build ${inputs.MARK_BUILD_STATUS} as configured in the task.` : 'Black Duck Security Action workflow execution completed successfully.')
3933
return exitCode
4034
} catch (error) {
4135
exitCode = getBridgeExitCodeAsNumericValue(error as Error)

0 commit comments

Comments
 (0)