diff --git a/plugins/github-release-manager/README.md b/plugins/github-release-manager/README.md index 273e81b252..331d04bafa 100644 --- a/plugins/github-release-manager/README.md +++ b/plugins/github-release-manager/README.md @@ -6,13 +6,13 @@ Does it build and ship your code? **No**. -What `GRM` does is manage your **[releases](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. +What `GRM` does is manage your **[releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)** on GitHub, building and shipping is entirely up to you as a developer to handle in your CI. `GRM` is built with industry standards in mind and the flow is as follows: ![](./src/cards/info/flow.png) -> **GitHub**: The source control system where releases reside in a practical sense. Read more about GitHub releases [here](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/. Note that this plugin works just as well with GitHub Enterprise) +> **GitHub**: The source control system where releases reside in a practical sense. Read more about [GitHub releases](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository). Note that this plugin works just as well with GitHub Enterprise) > > **Release Candidate (RC)**: A GitHub pre-release intended primarily for internal testing > diff --git a/plugins/github-release-manager/src/api/ApiClient.ts b/plugins/github-release-manager/src/api/ApiClient.ts index a3c1ce35e5..dcb9ba2288 100644 --- a/plugins/github-release-manager/src/api/ApiClient.ts +++ b/plugins/github-release-manager/src/api/ApiClient.ts @@ -54,6 +54,10 @@ export class ApiClient { this.githubCommonPath = `/repos/${this.repoPath}`; } + public getHost() { + return this.pluginApiClient.host; + } + public getRepoPath() { return this.repoPath; } diff --git a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts index 430b005b92..f06f25998c 100644 --- a/plugins/github-release-manager/src/api/PluginApiClientConfig.ts +++ b/plugins/github-release-manager/src/api/PluginApiClientConfig.ts @@ -19,7 +19,8 @@ import { readGitHubIntegrationConfigs } from '@backstage/integration'; export class PluginApiClientConfig { private readonly githubAuthApi: OAuthApi; - readonly baseUrl: string; + private readonly baseUrl: string; + readonly host: string; constructor({ configApi, @@ -33,7 +34,12 @@ export class PluginApiClientConfig { const configs = readGitHubIntegrationConfigs( configApi.getOptionalConfigArray('integrations.github') ?? [], ); - const githubIntegrationConfig = configs.find(v => v.host === 'github.com'); + + const githubIntegrationConfig = configs.find( + v => v.host === 'github.com' || v.host.startsWith('ghe.'), + ); + + this.host = githubIntegrationConfig?.host ?? 'github.com'; this.baseUrl = githubIntegrationConfig?.apiBaseUrl ?? 'https://api.github.com'; } diff --git a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts index 0a532dcb0d..11f93aedf1 100644 --- a/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts +++ b/plugins/github-release-manager/src/cards/createRc/sideEffects/createRc.ts @@ -99,7 +99,7 @@ export async function createRc({ `; responseSteps.push({ - message: 'Fetched commit comparision', + message: 'Fetched commit comparison', secondaryMessage: `${previousReleaseBranch}...${nextReleaseBranch}`, link: comparison.html_url, }); diff --git a/plugins/github-release-manager/src/cards/info/Info.tsx b/plugins/github-release-manager/src/cards/info/Info.tsx index 6b371ea873..d05d16bf85 100644 --- a/plugins/github-release-manager/src/cards/info/Info.tsx +++ b/plugins/github-release-manager/src/cards/info/Info.tsx @@ -47,12 +47,12 @@ export const Info = ({ GitHub: The source control system where releases - reside in a practical sense. Read more about GitHub releases{' '} + reside in a practical sense. Read more about{' '} - here + GitHub releases . Note that this plugin works just as well with GitHub Enterprise (GHE) diff --git a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx index 6d15bc6a08..80b53bb208 100644 --- a/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx +++ b/plugins/github-release-manager/src/cards/patchRc/PatchBody.tsx @@ -16,8 +16,6 @@ import React, { useState } from 'react'; import { Alert, AlertTitle } from '@material-ui/lab'; import { useAsync, useAsyncFn } from 'react-use'; -import FileCopyIcon from '@material-ui/icons/FileCopy'; -import Paper from '@material-ui/core/Paper'; import { Button, Checkbox, @@ -29,8 +27,10 @@ import { ListItemIcon, ListItemSecondaryAction, ListItemText, + Paper, Typography, } from '@material-ui/core'; +import FileCopyIcon from '@material-ui/icons/FileCopy'; import OpenInNewIcon from '@material-ui/icons/OpenInNew'; import { Differ } from '../../components/Differ'; @@ -229,12 +229,13 @@ export const PatchBody = ({ { const repoPath = apiClient.getRepoPath(); + const host = apiClient.getHost(); const newTab = window.open( - `https://github.com/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, + `https://${host}/${repoPath}/compare/${releaseBranch?.name}...${commit.sha}`, '_blank', ); newTab?.focus(); diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx index e4a3d78308..239e642884 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepList.tsx @@ -14,12 +14,15 @@ * limitations under the License. */ import React, { PropsWithChildren } from 'react'; -import { List, CircularProgress } from '@material-ui/core'; -import Button from '@material-ui/core/Button'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogTitle from '@material-ui/core/DialogTitle'; +import { + List, + CircularProgress, + Button, + Dialog, + DialogActions, + DialogContent, + DialogTitle, +} from '@material-ui/core'; import { ResponseStep, SetRefetch } from '../../types/types'; import { TEST_IDS } from '../../test-helpers/test-ids'; diff --git a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx index fd139dae89..21486ed87f 100644 --- a/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx +++ b/plugins/github-release-manager/src/components/ResponseStepList/ResponseStepListItem.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ import React, { useEffect, useState } from 'react'; -import { green, red } from '@material-ui/core/colors'; import { + colors, IconButton, ListItem, ListItemIcon, @@ -78,7 +78,7 @@ export const ResponseStepListItem = ({ return ( ); } @@ -87,7 +87,7 @@ export const ResponseStepListItem = ({ return ( ); }