From da41398e37ef581d83fc80382c05bbf9cdd02b45 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 18 Sep 2026 12:51:49 +0000 Subject: [PATCH] Add descriptive error for missing updater image catalog entry --- __tests__/main.test.ts | 34 ++++++++++++++++++++++++++++++++++ dist/main.js | 11 +++++++++++ src/main.ts | 12 ++++++++++++ 3 files changed, 57 insertions(+) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index de5868e57..5eee43cf9 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -412,6 +412,40 @@ describe('run', () => { }) }) + describe('when the package manager has no configured updater image', () => { + beforeEach(() => { + jest.spyOn(ImageService, 'pull') + jest.spyOn(ApiClient.prototype, 'getJobDetails').mockImplementationOnce( + jest.fn(async () => { + return {'package-manager': 'unknown_ecosystem'} as JobDetails + }) + ) + context = new Context() + }) + + test('it fails the workflow without attempting to pull images', async () => { + await run(context) + + expect(core.setFailed).toHaveBeenCalledWith( + expect.stringContaining('Error fetching updater images') + ) + // eslint-disable-next-line @typescript-eslint/unbound-method + expect(ImageService.pull).not.toHaveBeenCalled() + }) + + test('it relays a descriptive failure message to the dependabot service', async () => { + await run(context) + + expect(reportJobErrorSpy).toHaveBeenCalledWith({ + 'error-type': 'actions_workflow_image', + 'error-details': { + 'action-error': expect.stringContaining('unknown_ecosystem') + } + }) + expect(markJobAsProcessedSpy).toHaveBeenCalled() + }) + }) + describe('when there is an error pulling all images', () => { beforeEach(() => { jest diff --git a/dist/main.js b/dist/main.js index 723e033bf..7cb202009 100644 --- a/dist/main.js +++ b/dist/main.js @@ -100769,6 +100769,17 @@ async function run(context3) { const details = await apiClient.getJobDetails(); let updaterImage = params.updaterImage || updaterImageName(details["package-manager"]); let proxyImage = PROXY_IMAGE_NAME; + if (!updaterImage) { + await failJob( + apiClient, + "Error fetching updater images", + new Error( + `No updater image is configured for package manager '${details["package-manager"]}' in this action revision` + ), + "actions_workflow_image" /* Image */ + ); + return; + } const sendMetricsWithPackageManager = async (name, metricType, value, additionalTags = {}) => { try { await apiClient.sendMetrics(name, metricType, value, { diff --git a/src/main.ts b/src/main.ts index df04b002d..a36198cf3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -80,6 +80,18 @@ export async function run(context: Context): Promise { params.updaterImage || updaterImageName(details['package-manager']) let proxyImage = PROXY_IMAGE_NAME + if (!updaterImage) { + await failJob( + apiClient, + 'Error fetching updater images', + new Error( + `No updater image is configured for package manager '${details['package-manager']}' in this action revision` + ), + DependabotErrorType.Image + ) + return + } + // The sendMetrics function is used to send metrics to the API client. // It uses the package manager as a tag to identify the metric. const sendMetricsWithPackageManager: MetricReporter = async (