From 65c0561a075785be9b7e0ce65a57d1b6345d97c3 Mon Sep 17 00:00:00 2001 From: Dean Lindqvist Todevski <dean.todevski@gmail.com> Date: Mon, 27 Jan 2025 12:45:56 +0100 Subject: [PATCH] feat(bazel): set sourceUrl for Bazel modules (#33840) Co-authored-by: Michael Kriese <michael.kriese@gmx.de> --- .../bazel/__fixtures__/metadata-no-yanked-versions.json | 1 + lib/modules/datasource/bazel/index.spec.ts | 1 + lib/modules/datasource/bazel/index.ts | 3 +++ lib/modules/datasource/bazel/schema.ts | 1 + 4 files changed, 6 insertions(+) diff --git a/lib/modules/datasource/bazel/__fixtures__/metadata-no-yanked-versions.json b/lib/modules/datasource/bazel/__fixtures__/metadata-no-yanked-versions.json index 2bbf5b1186..4185ec2d0c 100644 --- a/lib/modules/datasource/bazel/__fixtures__/metadata-no-yanked-versions.json +++ b/lib/modules/datasource/bazel/__fixtures__/metadata-no-yanked-versions.json @@ -1,4 +1,5 @@ { + "homepage": "https://github.com/foo/bar", "versions": [ "0.14.8", "0.14.9", diff --git a/lib/modules/datasource/bazel/index.spec.ts b/lib/modules/datasource/bazel/index.spec.ts index f594d09fae..356743db17 100644 --- a/lib/modules/datasource/bazel/index.spec.ts +++ b/lib/modules/datasource/bazel/index.spec.ts @@ -58,6 +58,7 @@ describe('modules/datasource/bazel/index', () => { { version: '0.15.0' }, { version: '0.16.0' }, ], + sourceUrl: 'https://github.com/foo/bar', }); }); diff --git a/lib/modules/datasource/bazel/index.ts b/lib/modules/datasource/bazel/index.ts index a705a30426..277f08f640 100644 --- a/lib/modules/datasource/bazel/index.ts +++ b/lib/modules/datasource/bazel/index.ts @@ -57,6 +57,9 @@ export class BazelDatasource extends Datasource { } return release; }); + if (metadata.homepage) { + result.homepage = metadata.homepage; + } } catch (err) { // istanbul ignore else: not testable with nock if (err instanceof HttpError) { diff --git a/lib/modules/datasource/bazel/schema.ts b/lib/modules/datasource/bazel/schema.ts index 4315d260c4..6fe7245a57 100644 --- a/lib/modules/datasource/bazel/schema.ts +++ b/lib/modules/datasource/bazel/schema.ts @@ -1,6 +1,7 @@ import { z } from 'zod'; export const BazelModuleMetadata = z.object({ + homepage: z.string().optional().nullable(), versions: z.array(z.string()), yanked_versions: z.record(z.string(), z.string()), }); -- GitLab