From f1b573d58089d20a3b4164d7f272122b869adfb2 Mon Sep 17 00:00:00 2001 From: Alex Ross Date: Wed, 18 Dec 2024 15:47:35 +0100 Subject: [PATCH] When listing workflows running as checks against a PR, include workflow name, not just job name Fixes #6497 --- src/github/githubRepository.ts | 6 ++++++ src/github/graphql.ts | 6 ++++++ src/github/interface.ts | 4 +++- src/github/queriesShared.gql | 6 ++++++ webviews/components/merge.tsx | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/github/githubRepository.ts b/src/github/githubRepository.ts index 0357668d10..9b0a899621 100644 --- a/src/github/githubRepository.ts +++ b/src/github/githubRepository.ts @@ -1536,6 +1536,8 @@ export class GitHubRepository extends Disposable { state: this.mapStateAsCheckState(context.conclusion), description: context.title, context: context.name, + workflowName: context.checkSuite?.workflowRun?.workflow.name, + event: context.checkSuite?.workflowRun?.event, targetUrl: context.detailsUrl, isRequired: context.isRequired, }; @@ -1549,6 +1551,8 @@ export class GitHubRepository extends Disposable { state: this.mapStateAsCheckState(context.state), description: context.description, context: context.context, + workflowName: undefined, + event: undefined, targetUrl: context.targetUrl, isRequired: context.isRequired, }; @@ -1571,6 +1575,8 @@ export class GitHubRepository extends Disposable { state: CheckState.Pending, description: vscode.l10n.t('Waiting for status to be reported'), context: context, + workflowName: undefined, + event: undefined, targetUrl: prUrl, isRequired: true }); diff --git a/src/github/graphql.ts b/src/github/graphql.ts index 0408c39352..05f9a84cd6 100644 --- a/src/github/graphql.ts +++ b/src/github/graphql.ts @@ -878,6 +878,12 @@ export interface CheckRun { logoUrl: string; url: string; } | null; + workflowRun?: { + event: string; + workflow: { + name: string; + }; + }; }; isRequired: boolean; } diff --git a/src/github/interface.ts b/src/github/interface.ts index 5b7913fbc5..a1d4054ac0 100644 --- a/src/github/interface.ts +++ b/src/github/interface.ts @@ -306,7 +306,9 @@ export interface PullRequestCheckStatus { state: CheckState; description: string | null; targetUrl: string | null; - context: string; + context: string; // Job name + workflowName: string | undefined; + event: string | undefined; isRequired: boolean; } diff --git a/src/github/queriesShared.gql b/src/github/queriesShared.gql index 63d4f7402a..8a145f9b89 100644 --- a/src/github/queriesShared.gql +++ b/src/github/queriesShared.gql @@ -1166,6 +1166,12 @@ query GetChecks($owner: String!, $name: String!, $number: Int!) { logoUrl url } + workflowRun { + event + workflow { + name + } + } } } } diff --git a/webviews/components/merge.tsx b/webviews/components/merge.tsx index 72cdbea4c0..1d291ef021 100644 --- a/webviews/components/merge.tsx +++ b/webviews/components/merge.tsx @@ -526,7 +526,7 @@ const StatusCheckDetails = ( { statuses }: { statuses: PullRequestCheckStatus[] {/* allow-any-unicode-next-line */} - {s.context} {s.description ? `— ${s.description}` : ''} + {s.workflowName ? `${s.workflowName} / ` : null}{s.context}{s.event ? ` (${s.event})` : null} {s.description ? `— ${s.description}` : null}