Skip to content

feat(datasource): Add Nextcloud #37292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bdovaz
Copy link
Contributor

@bdovaz bdovaz commented Aug 3, 2025

Changes

Add Nextcloud data source.

Example PR: bdovaz/renovate_test#20

Readme.md custom manager example PR: bdovaz/renovate_test#18

Context

#37256

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@bdovaz bdovaz changed the title Nextcloud datasource feat(datasource): Add Nextcloud Aug 3, 2025
@bdovaz bdovaz marked this pull request as ready for review August 3, 2025 21:26
export const ApplicationRelease = z.object({
created: z.string(),
isNightly: z.boolean(),
translations: z.record(z.string(), Translation),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably use LooseRecord, so it filters Translation with missing changelog and doesn't discard all


export const Application = z.object({
id: z.string(),
releases: z.array(ApplicationRelease),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LooseArray ?

"customType": "regex",
"managerFilePatterns": ["/(^|/)renovate.json$/"],
"matchStrings": [
"https://apps.nextcloud.com/api/v1/platform/(?<currentValue>.*)/apps.json"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be non-greedy

Suggested change
"https://apps.nextcloud.com/api/v1/platform/(?<currentValue>.*)/apps.json"
"https://apps.nextcloud.com/api/v1/platform/(?<currentValue>.*?)/apps.json"

or make even more tight

Suggested change
"https://apps.nextcloud.com/api/v1/platform/(?<currentValue>.*)/apps.json"
"https://apps.nextcloud.com/api/v1/platform/(?<currentValue>\\d+\\.\\d+\\.\\d+)/apps.json"

import { cache } from '../../../util/cache/package/decorator';
import { regEx } from '../../../util/regex';
import { asTimestamp } from '../../../util/timestamp';
import * as semanticVersioning from '../../versioning/semver';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import * as semanticVersioning from '../../versioning/semver';
import * as semver from '../../versioning/semver';


static readonly defaultTranslationLanguage = 'en';

override readonly defaultVersioning = semanticVersioning.id;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
override readonly defaultVersioning = semanticVersioning.id;
override readonly defaultVersioning = semver.id;

export class NextcloudDatasource extends Datasource {
static readonly id = 'nextcloud';

static readonly defaultTranslationLanguage = 'en';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static readonly defaultTranslationLanguage = 'en';
private static readonly defaultTranslationLanguage = 'en';

not externally used, move before public members


override readonly defaultVersioning = semanticVersioning.id;

private static readonly sourceUrlRegex = regEx(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move before public properties


for (const release of application.releases) {
const changelogContent =
release.translations[NextcloudDatasource.defaultTranslationLanguage]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the translation is missing?

releaseTimestamp: asTimestamp(release.created),
changelogContent:
changelogContent.length > 0 ? changelogContent : undefined,
changelogUrl: sourceUrlMatches?.groups
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set it on ReleaseResult


const result: ReleaseResult = {
releases: [],
homepage: application.website,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set sourceUrl if the repo is on github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants