From ae7a775fb8c68f825f523c6b4643d673145e22c9 Mon Sep 17 00:00:00 2001 From: Thorsten Gilfert Date: Mon, 8 Apr 2024 13:00:40 +0000 Subject: [PATCH 1/5] Status checks are in an array of commits Signed-off-by: Thorsten Gilfert --- .../src/components/Card/Card.tsx | 2 +- .../src/components/Card/CardHeader.test.tsx | 12 +++++++----- .../src/components/Card/CardHeader.tsx | 6 ++++-- 3 files changed, 12 insertions(+), 8 deletions(-) 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 6642cdeb06..a84978cb28 100644 --- a/plugins/github-pull-requests-board/src/components/Card/Card.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/Card.tsx @@ -29,7 +29,7 @@ type Props = { isDraft: boolean; repositoryIsArchived: boolean; labels?: Label[]; - status?: Status; + status?: Status[]; }; const Card: FunctionComponent> = ( diff --git a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx index 02f8b8c837..f46396bc29 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx @@ -37,13 +37,15 @@ const props = { name: 'documentation', }, ], - status: { - commit: { - statusCheckRollup: { - state: 'SUCCESS', + status: [ + { + commit: { + statusCheckRollup: { + state: 'SUCCESS', + }, }, }, - }, + ], }; describe('', () => { 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 6c8c02da24..cbc937450b 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx @@ -32,7 +32,7 @@ type Props = { isDraft: boolean; repositoryIsArchived: boolean; labels?: Label[]; - status?: Status; + status?: Status[]; }; const CardHeader: FunctionComponent = (props: Props) => { @@ -92,7 +92,9 @@ const CardHeader: FunctionComponent = (props: Props) => { Commit Status:{' '} - {status.commit.statusCheckRollup?.state || 'N/A'} + + {status[0].commit.statusCheckRollup?.state || 'N/A'} + )} From c6cafe64c7c47a3ca6a674287b305350f6f072a6 Mon Sep 17 00:00:00 2001 From: Thorsten Gilfert Date: Mon, 8 Apr 2024 13:25:49 +0000 Subject: [PATCH 2/5] Added changeset Signed-off-by: Thorsten Gilfert --- .changeset/beige-worms-deny.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/beige-worms-deny.md diff --git a/.changeset/beige-worms-deny.md b/.changeset/beige-worms-deny.md new file mode 100644 index 0000000000..2492f35ea6 --- /dev/null +++ b/.changeset/beige-worms-deny.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-github-pull-requests-board': minor +--- + +Fixed bug in CardHeader not expecting commit status as an array as returned by GraphQL From c03e3067788887b72a1ce18e15483cdbc1ee6536 Mon Sep 17 00:00:00 2001 From: Thorsten Gilfert Date: Mon, 8 Apr 2024 13:56:42 +0000 Subject: [PATCH 3/5] Fixing test Signed-off-by: Thorsten Gilfert --- .../src/components/Card/CardHeader.test.tsx | 2 +- .../src/components/PullRequestCard/PullRequestCard.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx index f46396bc29..47d3713466 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.test.tsx @@ -67,7 +67,7 @@ describe('', () => { it('finds commit status in PR Card Header', async () => { await renderInTestApp(); expect(screen.getByText('Commit Status:')).toBeInTheDocument(); - expect(props.status?.commit.statusCheckRollup.state).toBeTruthy(); + expect(props.status[0].commit.statusCheckRollup.state).toBeTruthy(); }); it('does not find commit status in PR Card Header when PR does not include status', async () => { 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 59f7892d0e..b8549052a7 100644 --- a/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx +++ b/plugins/github-pull-requests-board/src/components/PullRequestCard/PullRequestCard.tsx @@ -30,7 +30,7 @@ type Props = { author: Author; url: string; reviews: Reviews; - status?: Status; + status?: Status[]; repositoryName: string; repositoryIsArchived: boolean; isDraft: boolean; From ecc412399c5e8fa5b06d2bbbe3925502d93eb0b5 Mon Sep 17 00:00:00 2001 From: Thorsten Gilfert Date: Mon, 8 Apr 2024 14:21:26 +0000 Subject: [PATCH 4/5] Fixing test Signed-off-by: Thorsten Gilfert --- .../EntityTeamPullRequestsCard.test.tsx | 2 +- .../EntityTeamPullRequestsContent.test.tsx | 2 +- plugins/github-pull-requests-board/src/utils/types.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.test.tsx b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.test.tsx index 28e1c89fc7..c839d72fe6 100644 --- a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.test.tsx +++ b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsCard/EntityTeamPullRequestsCard.test.tsx @@ -71,7 +71,7 @@ jest.mock('../../hooks/usePullRequestsByTeam', () => { nodes: [], }, commits: { - nodes: status, + nodes: [status], }, isDraft: isDraft, author: { diff --git a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.test.tsx b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.test.tsx index c38500a1ef..9580b820be 100644 --- a/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.test.tsx +++ b/plugins/github-pull-requests-board/src/components/EntityTeamPullRequestsContent/EntityTeamPullRequestsContent.test.tsx @@ -71,7 +71,7 @@ jest.mock('../../hooks/usePullRequestsByTeam', () => { nodes: [], }, commits: { - nodes: status, + nodes: [status], }, isDraft: isDraft, author: { diff --git a/plugins/github-pull-requests-board/src/utils/types.tsx b/plugins/github-pull-requests-board/src/utils/types.tsx index 41ba42c533..bd1261e8d7 100644 --- a/plugins/github-pull-requests-board/src/utils/types.tsx +++ b/plugins/github-pull-requests-board/src/utils/types.tsx @@ -99,7 +99,7 @@ export type PullRequest = { nodes: Reviews; }; commits: { - nodes: Status; + nodes: Status[]; }; mergeable: boolean; state: string; From ddf4f8d34790d8bb47a710e049c17004953ce790 Mon Sep 17 00:00:00 2001 From: Thorsten Gilfert <67371810+gilfthde@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:58:35 +0200 Subject: [PATCH 5/5] Update plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx Co-authored-by: Vincenzo Scamporlino Signed-off-by: Thorsten Gilfert <67371810+gilfthde@users.noreply.github.com> --- .../src/components/Card/CardHeader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cbc937450b..28b5acae2f 100644 --- a/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx +++ b/plugins/github-pull-requests-board/src/components/Card/CardHeader.tsx @@ -93,7 +93,7 @@ const CardHeader: FunctionComponent = (props: Props) => { Commit Status:{' '} - {status[0].commit.statusCheckRollup?.state || 'N/A'} + {status[0]?.commit.statusCheckRollup?.state || 'N/A'}