Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/init-action-post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/init-action-post.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions src/init-action-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ async function runWrapper() {
logger.warning(
"Debugging artifacts are unavailable since the 'init' Action failed before it could produce any.",
);
return;
} else {
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
}
Comment on lines +70 to 79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? I think this still doesn't send a status report if there's no config. Would this work?

Suggested change
} else {
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
}
}
uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's correct — the status report is sent later on in the file, but the original code was returning early so it was never sent.

The suggested change won't work because config is required to upload debug artifacts 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return is the problem. We won't be able to upload a failed SARIF file if we don't have a config, because we need CodeQL to do that. But we should still upload a status report, and the status report code comes at the end of the runWrapper function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah...got it. I only reviewed the changed bits, so I missed what's happening later. LGTM.


uploadFailedSarifResult = await initActionPostHelper.run(
debugArtifacts.tryUploadAllAvailableDebugArtifacts,
printDebugLogs,
config,
repositoryNwo,
features,
logger,
);
} catch (unwrappedError) {
const error = wrapError(unwrappedError);
core.setFailed(error.message);
Expand Down
Loading