Merge pull request #14192 from Bonial-International-GmbH/pjungermann/github/naming-part2
chore(integration): use consistent naming of `[gG]ithub` in code
This commit is contained in:
@@ -12,7 +12,7 @@ import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-backend';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-backend';
|
||||
import { GithubCredentialsProvider } from '@backstage/integration';
|
||||
import { GitHubIntegrationConfig } from '@backstage/integration';
|
||||
import { GithubIntegrationConfig } from '@backstage/integration';
|
||||
import { LocationSpec } from '@backstage/plugin-catalog-backend';
|
||||
import { Logger } from 'winston';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
@@ -160,7 +160,7 @@ export class GithubOrgEntityProvider implements EntityProvider {
|
||||
constructor(options: {
|
||||
id: string;
|
||||
orgUrl: string;
|
||||
gitHubConfig: GitHubIntegrationConfig;
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
logger: Logger;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
});
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import {
|
||||
DefaultGithubCredentialsProvider,
|
||||
GithubAppCredentialsMux,
|
||||
GithubCredentialsProvider,
|
||||
GitHubIntegrationConfig,
|
||||
GithubIntegrationConfig,
|
||||
ScmIntegrationRegistry,
|
||||
ScmIntegrations,
|
||||
} from '@backstage/integration';
|
||||
@@ -182,7 +182,7 @@ export class GithubMultiOrgReaderProcessor implements CatalogProcessor {
|
||||
|
||||
// Note: Does not support usage of PATs
|
||||
private async getAllOrgs(
|
||||
gitHubConfig: GitHubIntegrationConfig,
|
||||
gitHubConfig: GithubIntegrationConfig,
|
||||
): Promise<GithubMultiOrgConfig> {
|
||||
const githubAppMux = new GithubAppCredentialsMux(gitHubConfig);
|
||||
const installs = await githubAppMux.getAllInstallations();
|
||||
|
||||
@@ -19,8 +19,8 @@ import { Config } from '@backstage/config';
|
||||
import {
|
||||
GithubCredentialsProvider,
|
||||
ScmIntegrations,
|
||||
GitHubIntegrationConfig,
|
||||
GitHubIntegration,
|
||||
GithubIntegrationConfig,
|
||||
GithubIntegration,
|
||||
SingleInstanceGithubCredentialsProvider,
|
||||
} from '@backstage/integration';
|
||||
import {
|
||||
@@ -51,7 +51,7 @@ import { satisfiesTopicFilter } from '../lib/util';
|
||||
export class GithubEntityProvider implements EntityProvider {
|
||||
private readonly config: GithubEntityProviderConfig;
|
||||
private readonly logger: Logger;
|
||||
private readonly integration: GitHubIntegrationConfig;
|
||||
private readonly integration: GithubIntegrationConfig;
|
||||
private readonly scheduleFn: () => Promise<void>;
|
||||
private connection?: EntityProviderConnection;
|
||||
private readonly githubCredentialsProvider: GithubCredentialsProvider;
|
||||
@@ -101,7 +101,7 @@ export class GithubEntityProvider implements EntityProvider {
|
||||
|
||||
private constructor(
|
||||
config: GithubEntityProviderConfig,
|
||||
integration: GitHubIntegration,
|
||||
integration: GithubIntegration,
|
||||
logger: Logger,
|
||||
taskRunner: TaskRunner,
|
||||
) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { GroupEntity, UserEntity } from '@backstage/catalog-model';
|
||||
import {
|
||||
GithubCredentialsProvider,
|
||||
GitHubIntegrationConfig,
|
||||
GithubIntegrationConfig,
|
||||
} from '@backstage/integration';
|
||||
import { EntityProviderConnection } from '@backstage/plugin-catalog-backend';
|
||||
import { graphql } from '@octokit/graphql';
|
||||
@@ -87,7 +87,7 @@ describe('GithubOrgEntityProvider', () => {
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
const gitHubConfig: GitHubIntegrationConfig = {
|
||||
const gitHubConfig: GithubIntegrationConfig = {
|
||||
host: 'https://github.com',
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import { Config } from '@backstage/config';
|
||||
import {
|
||||
DefaultGithubCredentialsProvider,
|
||||
GithubCredentialsProvider,
|
||||
GitHubIntegrationConfig,
|
||||
GithubIntegrationConfig,
|
||||
ScmIntegrations,
|
||||
SingleInstanceGithubCredentialsProvider,
|
||||
} from '@backstage/integration';
|
||||
@@ -134,7 +134,7 @@ export class GithubOrgEntityProvider implements EntityProvider {
|
||||
private options: {
|
||||
id: string;
|
||||
orgUrl: string;
|
||||
gitHubConfig: GitHubIntegrationConfig;
|
||||
gitHubConfig: GithubIntegrationConfig;
|
||||
logger: Logger;
|
||||
githubCredentialsProvider?: GithubCredentialsProvider;
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
IdentityApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import {
|
||||
GitHubIntegrationConfig,
|
||||
GithubIntegrationConfig,
|
||||
ScmIntegrationRegistry,
|
||||
} from '@backstage/integration';
|
||||
import { ScmAuthApi } from '@backstage/integration-react';
|
||||
@@ -239,7 +239,7 @@ the component will become available.\n\nFor more information, read an \
|
||||
body: string;
|
||||
fileContent: string;
|
||||
repositoryUrl: string;
|
||||
githubIntegrationConfig: GitHubIntegrationConfig;
|
||||
githubIntegrationConfig: GithubIntegrationConfig;
|
||||
}): Promise<{ link: string; location: string }> {
|
||||
const {
|
||||
owner,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Octokit } from '@octokit/rest';
|
||||
import { GitHubIntegration, ScmIntegrations } from '@backstage/integration';
|
||||
import { GithubIntegration, ScmIntegrations } from '@backstage/integration';
|
||||
import { DISABLE_CACHE } from '../constants/constants';
|
||||
|
||||
import { Project } from '../contexts/ProjectContext';
|
||||
@@ -50,7 +50,7 @@ export class GitReleaseClient implements GitReleaseApi {
|
||||
private getGithubIntegrationConfig({
|
||||
gitHubIntegrations,
|
||||
}: {
|
||||
gitHubIntegrations: GitHubIntegration[];
|
||||
gitHubIntegrations: GithubIntegration[];
|
||||
}) {
|
||||
const defaultIntegration = gitHubIntegrations.find(
|
||||
({ config: { host } }) => host === 'github.com',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import { GithubActionsApi } from './GithubActionsApi';
|
||||
import { Octokit, RestEndpointMethodTypes } from '@octokit/rest';
|
||||
import { ConfigApi, OAuthApi } from '@backstage/core-plugin-api';
|
||||
@@ -36,7 +36,7 @@ export class GithubActionsClient implements GithubActionsApi {
|
||||
private async getOctokit(hostname?: string): Promise<Octokit> {
|
||||
// TODO: Get access token for the specified hostname
|
||||
const token = await this.githubAuthApi.getAccessToken(['repo']);
|
||||
const configs = readGitHubIntegrationConfigs(
|
||||
const configs = readGithubIntegrationConfigs(
|
||||
this.configApi.getOptionalConfigArray('integrations.github') ?? [],
|
||||
);
|
||||
const githubIntegrationConfig = configs.find(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
LinearProgress,
|
||||
@@ -88,7 +88,7 @@ export const LatestWorkflowRunCard = (props: {
|
||||
const config = useApi(configApiRef);
|
||||
const errorApi = useApi(errorApiRef);
|
||||
// TODO: Get github hostname from metadata annotation
|
||||
const hostname = readGitHubIntegrationConfigs(
|
||||
const hostname = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].host;
|
||||
const [owner, repo] = (
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
@@ -52,7 +52,7 @@ export const RecentWorkflowRunsCard = (props: {
|
||||
const errorApi = useApi(errorApiRef);
|
||||
|
||||
// TODO: Get github hostname from metadata annotation
|
||||
const hostname = readGitHubIntegrationConfigs(
|
||||
const hostname = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].host;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import {
|
||||
Accordion,
|
||||
AccordionDetails,
|
||||
@@ -170,7 +170,7 @@ export const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {
|
||||
const projectName = getProjectNameFromEntity(entity);
|
||||
|
||||
// TODO: Get github hostname from metadata annotation
|
||||
const hostname = readGitHubIntegrationConfigs(
|
||||
const hostname = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].host;
|
||||
const [owner, repo] = (projectName && projectName.split('/')) || [];
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { LogViewer } from '@backstage/core-components';
|
||||
import { configApiRef, useApi } from '@backstage/core-plugin-api';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import {
|
||||
Accordion,
|
||||
AccordionSummary,
|
||||
@@ -80,7 +80,7 @@ export const WorkflowRunLogs = ({
|
||||
const projectName = getProjectNameFromEntity(entity);
|
||||
|
||||
// TODO: Get github hostname from metadata annotation
|
||||
const hostname = readGitHubIntegrationConfigs(
|
||||
const hostname = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].host;
|
||||
const [owner, repo] = (projectName && projectName.split('/')) || [];
|
||||
|
||||
@@ -31,7 +31,7 @@ import SyncIcon from '@material-ui/icons/Sync';
|
||||
import { buildRouteRef } from '../../routes';
|
||||
import { getProjectNameFromEntity } from '../getProjectNameFromEntity';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
|
||||
import { EmptyState, Table, TableColumn } from '@backstage/core-components';
|
||||
import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
|
||||
@@ -159,7 +159,7 @@ export const WorkflowRunsTable = ({
|
||||
const config = useApi(configApiRef);
|
||||
const projectName = getProjectNameFromEntity(entity);
|
||||
// TODO: Get github hostname from metadata annotation
|
||||
const hostname = readGitHubIntegrationConfigs(
|
||||
const hostname = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].host;
|
||||
const [owner, repo] = (projectName ?? '/').split('/');
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
ErrorApi,
|
||||
OAuthApi,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
import { ForwardedError } from '@backstage/errors';
|
||||
|
||||
/** @internal */
|
||||
@@ -115,7 +115,7 @@ export const gitHubIssuesApi = (
|
||||
let octokit: Octokit;
|
||||
|
||||
const getOctokit = async () => {
|
||||
const baseUrl = readGitHubIntegrationConfigs(
|
||||
const baseUrl = readGithubIntegrationConfigs(
|
||||
configApi.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].apiBaseUrl;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
githubAuthApiRef,
|
||||
configApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { readGitHubIntegrationConfigs } from '@backstage/integration';
|
||||
import { readGithubIntegrationConfigs } from '@backstage/integration';
|
||||
|
||||
let octokit: any;
|
||||
|
||||
@@ -27,7 +27,7 @@ export const useOctokitGraphQl = <T>() => {
|
||||
const auth = useApi(githubAuthApiRef);
|
||||
const config = useApi(configApiRef);
|
||||
|
||||
const baseUrl = readGitHubIntegrationConfigs(
|
||||
const baseUrl = readGithubIntegrationConfigs(
|
||||
config.getOptionalConfigArray('integrations.github') ?? [],
|
||||
)[0].apiBaseUrl;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import parseGitUrl from 'git-url-parse';
|
||||
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
replaceGitHubUrlType,
|
||||
replaceGithubUrlType,
|
||||
replaceGitLabUrlType,
|
||||
} from '@backstage/integration';
|
||||
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
||||
@@ -31,7 +31,7 @@ import { PAGE_EDIT_LINK_SELECTOR } from './constants';
|
||||
|
||||
const resolveBlobUrl = (url: string, type: string) => {
|
||||
if (type === 'github') {
|
||||
return replaceGitHubUrlType(url, 'blob');
|
||||
return replaceGithubUrlType(url, 'blob');
|
||||
} else if (type === 'gitlab') {
|
||||
return replaceGitLabUrlType(url, 'blob');
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import type { Transformer } from './index';
|
||||
import {
|
||||
replaceGitHubUrlType,
|
||||
replaceGithubUrlType,
|
||||
ScmIntegrationRegistry,
|
||||
} from '@backstage/integration';
|
||||
import FeedbackOutlinedIcon from '@material-ui/icons/FeedbackOutlined';
|
||||
@@ -59,7 +59,7 @@ export const addGitFeedbackLink = (
|
||||
// Convert GitHub edit url to blob type so it can be parsed by git-url-parse correctly
|
||||
const gitUrl =
|
||||
integration?.type === 'github'
|
||||
? replaceGitHubUrlType(sourceURL.href, 'blob')
|
||||
? replaceGithubUrlType(sourceURL.href, 'blob')
|
||||
: sourceURL.href;
|
||||
const gitInfo = parseGitUrl(gitUrl);
|
||||
const repoPath = `/${gitInfo.organization}/${gitInfo.name}`;
|
||||
|
||||
Reference in New Issue
Block a user