diff --git a/packages/app/package.json b/packages/app/package.json index 43b12a1cb7..769a28eec1 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -45,6 +45,7 @@ "@backstage/plugin-gcalendar": "workspace:^", "@backstage/plugin-gcp-projects": "workspace:^", "@backstage/plugin-github-actions": "workspace:^", + "@backstage/plugin-github-pull-requests-board": "workspace:^", "@backstage/plugin-gocd": "workspace:^", "@backstage/plugin-graphiql": "workspace:^", "@backstage/plugin-home": "workspace:^", diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index 4d5f65cbbe..b0b227be92 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -185,6 +185,7 @@ import { isLinguistAvailable, EntityLinguistCard, } from '@backstage/plugin-linguist'; +import { EntityTeamPullRequestsContent } from '@backstage/plugin-github-pull-requests-board'; const customEntityFilterKind = ['Component', 'API', 'System']; @@ -809,6 +810,9 @@ const groupPage = ( + + + ); diff --git a/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts b/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts index 75f4d37cf4..8b919ce3d6 100644 --- a/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts +++ b/plugins/github-pull-requests-board/src/api/useGetPullRequestDetails.ts @@ -57,6 +57,15 @@ export const useGetPullRequestDetails = () => { state } } + commits(last: 1) { + nodes { + commit { + statusCheckRollup { + state + } + } + } + } mergeable state reviewDecision diff --git a/plugins/github-pull-requests-board/src/components/Card/Card.tsx b/plugins/github-pull-requests-board/src/components/Card/Card.tsx index 4fe833fa67..09c6352b60 100644 --- a/plugins/github-pull-requests-board/src/components/Card/Card.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/Card.tsx @@ -16,7 +16,7 @@ import React, { PropsWithChildren, FunctionComponent } from 'react'; import { Box, Paper, CardActionArea } from '@material-ui/core'; import CardHeader from './CardHeader'; -import { Label } from '../../utils/types'; +import { Label, Status } from '../../utils/types'; type Props = { title: string; @@ -29,6 +29,7 @@ type Props = { isDraft: boolean; repositoryIsArchived: boolean; labels?: Label[]; + status: Status; }; const Card: FunctionComponent> = ( @@ -45,6 +46,7 @@ const Card: FunctionComponent> = ( isDraft, repositoryIsArchived, labels, + status, children, } = props; @@ -63,6 +65,7 @@ const Card: FunctionComponent> = ( isDraft={isDraft} repositoryIsArchived={repositoryIsArchived} labels={labels} + status={status} /> {children} diff --git a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx index c59349b95f..98d53f781c 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx @@ -19,7 +19,7 @@ import { getElapsedTime } from '../../utils/functions'; import { UserHeader } from '../UserHeader'; import { DraftPrIcon } from '../icons/DraftPr'; import UnarchiveIcon from '@material-ui/icons/Unarchive'; -import { Label } from '../../utils/types'; +import { Label, Status } from '../../utils/types'; import { useFormClasses } from './styles'; type Props = { @@ -32,6 +32,7 @@ type Props = { isDraft: boolean; repositoryIsArchived: boolean; labels?: Label[]; + status: Status; }; const CardHeader: FunctionComponent = (props: Props) => { @@ -47,6 +48,7 @@ const CardHeader: FunctionComponent = (props: Props) => { isDraft, repositoryIsArchived, labels, + status: commitStatus, } = props; return ( @@ -86,6 +88,12 @@ const CardHeader: FunctionComponent = (props: Props) => { )} + + + Commit Status:{' '} + {commitStatus.commit.statusCheckRollup.state} + + {labels && ( {labels.map(data => { diff --git a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx index f901acb119..6109ddb63c 100644 --- a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx +++ b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.tsx @@ -87,6 +87,9 @@ const EntityTeamPullRequestsContent = ( return ; } + // eslint-disable-next-line no-console + console.log('pull - ', pullRequests); + return ( {pullRequests.length ? ( @@ -103,6 +106,7 @@ const EntityTeamPullRequestsContent = ( author, url, latestReviews, + commits, repository, isDraft, labels, @@ -125,6 +129,7 @@ const EntityTeamPullRequestsContent = ( author={author} url={url} reviews={latestReviews.nodes} + status={commits.nodes} repositoryName={repository.name} repositoryIsArchived={repository.isArchived} isDraft={isDraft} diff --git a/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx b/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx index e9ad2aeab6..8736644f09 100644 --- a/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx +++ b/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx @@ -19,7 +19,7 @@ import { getChangeRequests, getCommentedReviews, } from '../../utils/functions'; -import { Reviews, Author, Label } from '../../utils/types'; +import { Reviews, Author, Label, Status } from '../../utils/types'; import { Card } from '../Card'; import { UserHeaderList } from '../UserHeaderList'; @@ -30,6 +30,7 @@ type Props = { author: Author; url: string; reviews: Reviews; + status: Status; repositoryName: string; repositoryIsArchived: boolean; isDraft: boolean; @@ -44,6 +45,7 @@ const PullRequestCard: FunctionComponent = (props: Props) => { author, url, reviews, + status, repositoryName, repositoryIsArchived, isDraft, @@ -66,6 +68,7 @@ const PullRequestCard: FunctionComponent = (props: Props) => { isDraft={isDraft} repositoryIsArchived={repositoryIsArchived} labels={labels} + status={status} > {!!approvedReviews.length && (