From 0ac5f1b88751fbdddcca82a7b2e8bcb0ec47ca3f Mon Sep 17 00:00:00 2001 From: Nikhil Mittal Date: Mon, 4 May 2026 13:21:41 +0530 Subject: [PATCH 1/4] Build: Update dist/index.js with GHES artifact upload changes --- dist/index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5cdeba0..e1743dd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -105946,7 +105946,9 @@ exports.MESSAGES = { CODE_ANALYZER_FAILED: 'Salesforce Code Analyzer failed.', UNEXPECTED_ERROR: `An unexpected error was thrown (see below). First check to make sure you're providing valid ` + `inputs. If you can't resolve the error, then create an issue at ` + - `https://github.com/forcedotcom/run-code-analyzer/issues.` + `https://github.com/forcedotcom/run-code-analyzer/issues.`, + ARTIFACT_UPLOAD_SKIPPED_GHES: `Artifact upload is not supported on GitHub Enterprise Server. Skipping artifact upload. ` + + `All other results (violation counts, job summary, and pull request review) are still available.` }; exports.MESSAGE_FCNS = { PLUGIN_FOUND: (pluginName, pluginVersion) => `Found version ${pluginVersion} of the ${pluginName} plugin installed.`, @@ -106201,7 +106203,17 @@ async function run(dependencies, commandExecutor, resultsFactory, summarizer) { dependencies.startGroup(constants_1.MESSAGES.STEP_LABELS.UPLOADING_ARTIFACT); userOutputFiles.map(f => assertFileExists(dependencies, f)); assertFileExists(dependencies, jsonOutputFile); - await dependencies.uploadArtifact(inputs.resultsArtifactName, userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile]); + try { + await dependencies.uploadArtifact(inputs.resultsArtifactName, userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile]); + } + catch (error) { + if (error instanceof Error && error.message.includes('not currently supported on GHES')) { + dependencies.warn(constants_1.MESSAGES.ARTIFACT_UPLOAD_SKIPPED_GHES); + } + else { + throw error; + } + } dependencies.endGroup(); dependencies.startGroup(constants_1.MESSAGES.STEP_LABELS.ANALYZING_RESULTS); assertFileExists(dependencies, jsonOutputFile); From cd66d3ccc35989cd6b8e05bc560859395f527a28 Mon Sep 17 00:00:00 2001 From: Nikhil Mittal Date: Wed, 6 May 2026 14:31:12 +0530 Subject: [PATCH 2/4] test: simulate GHES error --- src/main.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index b293272..77222c4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -53,10 +53,11 @@ export async function run( userOutputFiles.map(f => assertFileExists(dependencies, f)) assertFileExists(dependencies, jsonOutputFile) try { - await dependencies.uploadArtifact( - inputs.resultsArtifactName, - userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] - ) + throw new Error('GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.') + // await dependencies.uploadArtifact( + // inputs.resultsArtifactName, + // userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] + // ) } catch (error) { if (error instanceof Error && error.message.includes('not currently supported on GHES')) { dependencies.warn(MESSAGES.ARTIFACT_UPLOAD_SKIPPED_GHES) From bbbe7eb13461c6383a48f6f48179a58ebeae9892 Mon Sep 17 00:00:00 2001 From: Nikhil Mittal Date: Wed, 6 May 2026 14:41:24 +0530 Subject: [PATCH 3/4] rebuild dist --- dist/index.js | 6 +++++- src/main.ts | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e1743dd..8e1229e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -106204,7 +106204,11 @@ async function run(dependencies, commandExecutor, resultsFactory, summarizer) { userOutputFiles.map(f => assertFileExists(dependencies, f)); assertFileExists(dependencies, jsonOutputFile); try { - await dependencies.uploadArtifact(inputs.resultsArtifactName, userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile]); + throw new Error('GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.'); + // await dependencies.uploadArtifact( + // inputs.resultsArtifactName, + // userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] + // ) } catch (error) { if (error instanceof Error && error.message.includes('not currently supported on GHES')) { diff --git a/src/main.ts b/src/main.ts index 77222c4..16b8407 100644 --- a/src/main.ts +++ b/src/main.ts @@ -53,7 +53,9 @@ export async function run( userOutputFiles.map(f => assertFileExists(dependencies, f)) assertFileExists(dependencies, jsonOutputFile) try { - throw new Error('GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.') + throw new Error( + 'GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.' + ) // await dependencies.uploadArtifact( // inputs.resultsArtifactName, // userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] From 8a1ec38039fdfd28846ef79a1489347c96fab532 Mon Sep 17 00:00:00 2001 From: Nikhil Mittal Date: Wed, 6 May 2026 14:56:54 +0530 Subject: [PATCH 4/4] rebuild dist --- dist/index.js | 13 +++---------- src/main.ts | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8e1229e..ddb8edb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -106205,19 +106205,12 @@ async function run(dependencies, commandExecutor, resultsFactory, summarizer) { assertFileExists(dependencies, jsonOutputFile); try { throw new Error('GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.'); - // await dependencies.uploadArtifact( - // inputs.resultsArtifactName, - // userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] - // ) } catch (error) { - if (error instanceof Error && error.message.includes('not currently supported on GHES')) { - dependencies.warn(constants_1.MESSAGES.ARTIFACT_UPLOAD_SKIPPED_GHES); - } - else { - throw error; - } + // Intentionally throw error to simulate GHES environment + throw error; } + await dependencies.uploadArtifact(inputs.resultsArtifactName, userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile]); dependencies.endGroup(); dependencies.startGroup(constants_1.MESSAGES.STEP_LABELS.ANALYZING_RESULTS); assertFileExists(dependencies, jsonOutputFile); diff --git a/src/main.ts b/src/main.ts index 16b8407..72224e8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -56,22 +56,19 @@ export async function run( throw new Error( 'GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.' ) - // await dependencies.uploadArtifact( - // inputs.resultsArtifactName, - // userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile] - // ) } catch (error) { - if (error instanceof Error && error.message.includes('not currently supported on GHES')) { - dependencies.warn(MESSAGES.ARTIFACT_UPLOAD_SKIPPED_GHES) - } else { - throw error - } + // Intentionally throw error to simulate GHES environment + throw error } + await dependencies.uploadArtifact( + inputs.resultsArtifactName, + userOutputFiles.length > 0 ? userOutputFiles : [jsonOutputFile!] + ) dependencies.endGroup() dependencies.startGroup(MESSAGES.STEP_LABELS.ANALYZING_RESULTS) - assertFileExists(dependencies, jsonOutputFile) - const results: Results = resultsFactory.createResults(jsonOutputFile) + assertFileExists(dependencies, jsonOutputFile!) + const results: Results = resultsFactory.createResults(jsonOutputFile!) dependencies.setOutput('num-violations', results.getTotalViolationCount().toString()) dependencies.setOutput('num-sev1-violations', results.getSev1ViolationCount().toString()) dependencies.setOutput('num-sev2-violations', results.getSev2ViolationCount().toString()) @@ -96,7 +93,7 @@ export async function run( let couldReadChangedFiles = true try { dependencies.info(MESSAGES.CALCULATING_CHANGED_FILES) - changedFiles = await dependencies.getChangedFiles(inputs.githubToken) + changedFiles = await dependencies.getChangedFiles(inputs.githubToken!) dependencies.info(MESSAGES.CALCULATED_CHANGED_FILES) } catch (error) { couldReadChangedFiles = false @@ -121,7 +118,7 @@ export async function run( setChangedFilesOutputs(dependencies, severityCounts) // Create PR review - const summaryLink: string = await dependencies.createActionSummaryLink(inputs.githubToken) + const summaryLink: string = await dependencies.createActionSummaryLink(inputs.githubToken!) const summaryBody = MESSAGE_FCNS.REVIEW_BODY( results.getTotalViolationCount(), severityCounts.total, @@ -129,7 +126,7 @@ export async function run( ) try { dependencies.info(MESSAGES.ATTEMPTING_TO_CREATE_PR_REVIEW) - const reviewId: number = await dependencies.createPullRequestReview(inputs.githubToken, summaryBody) + const reviewId: number = await dependencies.createPullRequestReview(inputs.githubToken!, summaryBody) dependencies.setOutput('review-id', `${reviewId}`) dependencies.info(MESSAGE_FCNS.CREATED_PR_REVIEW(reviewId)) } catch (error) {