Skip to content

Commit

Permalink
🐛 Limit dependencies list in GitHub commit if it's too large (QD-9677)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Aug 6, 2024
1 parent d273417 commit 21595cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion scan/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134513,6 +134513,7 @@ so that the action will upload the files as the job artifacts:
\`\`\`
`;
var SUMMARY_PR_MODE = `\u{1F4A1} Qodana analysis was run in the pull request mode: only the changed files were checked`;
var DEPENDENCY_CHARS_LIMIT = 65e3;
function wrapToDiffBlock(message) {
return `\`\`\`diff
${message}
Expand Down Expand Up @@ -134625,7 +134626,7 @@ ${body}
function getSummary(toolName, projectDir, annotations, coverageInfo, packages, licensesInfo, reportUrl, prMode) {
const contactBlock = wrapToToggleBlock("Contact Qodana team", SUMMARY_MISC);
let licensesBlock = "";
if (licensesInfo !== "") {
if (licensesInfo !== "" && licensesInfo.length < DEPENDENCY_CHARS_LIMIT) {
licensesBlock = wrapToToggleBlock(`Detected ${packages} ${getDepencencyPlural(packages)}`, licensesInfo);
}
let prModeBlock = "";
Expand Down
3 changes: 2 additions & 1 deletion scan/src/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ so that the action will upload the files as the job artifacts:
\`\`\`
`
const SUMMARY_PR_MODE = `💡 Qodana analysis was run in the pull request mode: only the changed files were checked`
const DEPENDENCY_CHARS_LIMIT = 65000 // 65k chars is the GitHub limit for a comment

function wrapToDiffBlock(message: string): string {
return `\`\`\`diff
Expand Down Expand Up @@ -262,7 +263,7 @@ export function getSummary(
): string {
const contactBlock = wrapToToggleBlock('Contact Qodana team', SUMMARY_MISC)
let licensesBlock = ''
if (licensesInfo !== '') {
if (licensesInfo !== '' && licensesInfo.length < DEPENDENCY_CHARS_LIMIT) {
licensesBlock = wrapToToggleBlock(
`Detected ${packages} ${getDepencencyPlural(packages)}`,
licensesInfo
Expand Down

0 comments on commit 21595cb

Please sign in to comment.