refactor: renamed GitHubPackages integration to GitHubContainerRegistry, and all related code (#3727)
This commit is contained in:
@@ -214,8 +214,8 @@ export const integrationDefs = {
|
|||||||
category: ["releasesProvider"],
|
category: ["releasesProvider"],
|
||||||
defaultUrl: "https://api.linuxserver.io",
|
defaultUrl: "https://api.linuxserver.io",
|
||||||
},
|
},
|
||||||
githubPackages: {
|
gitHubContainerRegistry: {
|
||||||
name: "Github Packages",
|
name: "GitHub Container Registry",
|
||||||
secretKinds: [[], ["personalAccessToken"]],
|
secretKinds: [[], ["personalAccessToken"]],
|
||||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
||||||
category: ["releasesProvider"],
|
category: ["releasesProvider"],
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { QBitTorrentIntegration } from "../download-client/qbittorrent/qbittorre
|
|||||||
import { SabnzbdIntegration } from "../download-client/sabnzbd/sabnzbd-integration";
|
import { SabnzbdIntegration } from "../download-client/sabnzbd/sabnzbd-integration";
|
||||||
import { TransmissionIntegration } from "../download-client/transmission/transmission-integration";
|
import { TransmissionIntegration } from "../download-client/transmission/transmission-integration";
|
||||||
import { EmbyIntegration } from "../emby/emby-integration";
|
import { EmbyIntegration } from "../emby/emby-integration";
|
||||||
import { GithubPackagesIntegration } from "../github-packages/github-packages-integration";
|
import { GitHubContainerRegistryIntegration } from "../github-container-registry/github-container-registry-integration";
|
||||||
import { GithubIntegration } from "../github/github-integration";
|
import { GithubIntegration } from "../github/github-integration";
|
||||||
import { GitlabIntegration } from "../gitlab/gitlab-integration";
|
import { GitlabIntegration } from "../gitlab/gitlab-integration";
|
||||||
import { HomeAssistantIntegration } from "../homeassistant/homeassistant-integration";
|
import { HomeAssistantIntegration } from "../homeassistant/homeassistant-integration";
|
||||||
@@ -108,7 +108,7 @@ export const integrationCreators = {
|
|||||||
npm: NPMIntegration,
|
npm: NPMIntegration,
|
||||||
codeberg: CodebergIntegration,
|
codeberg: CodebergIntegration,
|
||||||
linuxServerIO: LinuxServerIOIntegration,
|
linuxServerIO: LinuxServerIOIntegration,
|
||||||
githubPackages: GithubPackagesIntegration,
|
gitHubContainerRegistry: GitHubContainerRegistryIntegration,
|
||||||
quay: QuayIntegration,
|
quay: QuayIntegration,
|
||||||
ntfy: NTFYIntegration,
|
ntfy: NTFYIntegration,
|
||||||
mock: MockIntegration,
|
mock: MockIntegration,
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ import type {
|
|||||||
ReleasesResponse,
|
ReleasesResponse,
|
||||||
} from "../interfaces/releases-providers/releases-providers-types";
|
} from "../interfaces/releases-providers/releases-providers-types";
|
||||||
|
|
||||||
const localLogger = logger.child({ module: "GithubPackagesIntegration" });
|
const localLogger = logger.child({ module: "GitHubContainerRegistryIntegration" });
|
||||||
|
|
||||||
export class GithubPackagesIntegration extends Integration implements ReleasesProviderIntegration {
|
export class GitHubContainerRegistryIntegration extends Integration implements ReleasesProviderIntegration {
|
||||||
private static readonly userAgent = "Homarr-Lab/Homarr:GithubPackagesIntegration";
|
private static readonly userAgent = "Homarr-Lab/Homarr:GitHubContainerRegistryIntegration";
|
||||||
|
|
||||||
protected async testingAsync(input: IntegrationTestingInput): Promise<TestingResult> {
|
protected async testingAsync(input: IntegrationTestingInput): Promise<TestingResult> {
|
||||||
const headers: RequestInit["headers"] = {
|
const headers: RequestInit["headers"] = {
|
||||||
"User-Agent": GithubPackagesIntegration.userAgent,
|
"User-Agent": GitHubContainerRegistryIntegration.userAgent,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.hasSecretValue("personalAccessToken"))
|
if (this.hasSecretValue("personalAccessToken"))
|
||||||
@@ -46,7 +46,7 @@ export class GithubPackagesIntegration extends Integration implements ReleasesPr
|
|||||||
const [owner, name] = repository.identifier.split("/");
|
const [owner, name] = repository.identifier.split("/");
|
||||||
if (!owner || !name) {
|
if (!owner || !name) {
|
||||||
localLogger.warn(
|
localLogger.warn(
|
||||||
`Invalid identifier format. Expected 'owner/name', for ${repository.identifier} with Github Packages integration`,
|
`Invalid identifier format. Expected 'owner/name', for ${repository.identifier} with GitHub Container Registry integration`,
|
||||||
{
|
{
|
||||||
identifier: repository.identifier,
|
identifier: repository.identifier,
|
||||||
},
|
},
|
||||||
@@ -86,7 +86,7 @@ export class GithubPackagesIntegration extends Integration implements ReleasesPr
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage = error instanceof RequestError ? error.message : String(error);
|
const errorMessage = error instanceof RequestError ? error.message : String(error);
|
||||||
|
|
||||||
localLogger.warn(`Failed to get releases for ${owner}\\${name} with Github Packages integration`, {
|
localLogger.warn(`Failed to get releases for ${owner}\\${name} with GitHub Container Registry integration`, {
|
||||||
owner,
|
owner,
|
||||||
name,
|
name,
|
||||||
error: errorMessage,
|
error: errorMessage,
|
||||||
@@ -122,7 +122,7 @@ export class GithubPackagesIntegration extends Integration implements ReleasesPr
|
|||||||
forksCount: response.data.repository?.forks_count,
|
forksCount: response.data.repository?.forks_count,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
localLogger.warn(`Failed to get details for ${owner}\\${name} with Github Packages integration`, {
|
localLogger.warn(`Failed to get details for ${owner}\\${name} with GitHub Container Registry integration`, {
|
||||||
owner,
|
owner,
|
||||||
name,
|
name,
|
||||||
error: error instanceof RequestError ? error.message : String(error),
|
error: error instanceof RequestError ? error.message : String(error),
|
||||||
@@ -137,7 +137,7 @@ export class GithubPackagesIntegration extends Integration implements ReleasesPr
|
|||||||
request: {
|
request: {
|
||||||
fetch: fetchWithTrustedCertificatesAsync,
|
fetch: fetchWithTrustedCertificatesAsync,
|
||||||
},
|
},
|
||||||
userAgent: GithubPackagesIntegration.userAgent,
|
userAgent: GitHubContainerRegistryIntegration.userAgent,
|
||||||
throttle: { enabled: false }, // Disable throttling for this integration, Octokit will retry by default after a set time, thus delaying the repsonse to the user in case of errors. Errors will be shown to the user, no need to retry the request.
|
throttle: { enabled: false }, // Disable throttling for this integration, Octokit will retry by default after a set time, thus delaying the repsonse to the user in case of errors. Errors will be shown to the user, no need to retry the request.
|
||||||
...(this.hasSecretValue("personalAccessToken") ? { auth: this.getSecretValue("personalAccessToken") } : {}),
|
...(this.hasSecretValue("personalAccessToken") ? { auth: this.getSecretValue("personalAccessToken") } : {}),
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user