diff --git a/dist/index.js b/dist/index.js index 5cdeba0..ddb8edb 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,6 +106203,13 @@ 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); + try { + throw new Error('GHESNotSupportedError: @actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.'); + } + catch (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); diff --git a/src/main.ts b/src/main.ts index b293272..72224e8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -53,22 +53,22 @@ 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.' ) } 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()) @@ -93,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 @@ -118,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, @@ -126,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) {