diff --git a/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx b/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx
index d1930bf5dd..1e38d23d31 100644
--- a/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx
+++ b/plugins/github-actions/src/components/WorkflowRunDetails/WorkflowRunDetails.tsx
@@ -170,22 +170,19 @@ export const WorkflowRunDetails = ({ entity }: { entity: Entity }) => {
const hostname = readGitHubIntegrationConfigs(
config.getOptionalConfigArray('integrations.github') ?? [],
)[0].host;
- const [owner, repo] = projectName.value ? projectName.value.split('/') : [];
+ const [owner, repo] = (projectName && projectName.split('/')) || [];
const details = useWorkflowRunsDetails({ hostname, owner, repo });
const jobs = useWorkflowRunJobs({ hostname, owner, repo });
- const error = projectName.error || (projectName.value && details.error);
- const loading = projectName.loading || details.loading || !details.value;
-
const classes = useStyles();
- if (error && error.message) {
+ if (details.error && details.error.message) {
return (
- Failed to load build, {error.message}
+ Failed to load build, {details.error.message}
);
- } else if (loading) {
+ } else if (details.loading) {
return ;
}
return (
diff --git a/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunJobs.ts b/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunJobs.ts
index 002d379ed1..43fd7cdb5e 100644
--- a/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunJobs.ts
+++ b/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunJobs.ts
@@ -37,7 +37,7 @@ export const useWorkflowRunJobs = ({
repo,
id: parseInt(id, 10),
})
- : Promise.reject('No repo/owner provided');
+ : Promise.reject(Error('No repo/owner provided'));
}, [repo, owner, id]);
return jobs;
};
diff --git a/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts b/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts
index ef9b4f7ccf..dd5b62c733 100644
--- a/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts
+++ b/plugins/github-actions/src/components/WorkflowRunDetails/useWorkflowRunsDetails.ts
@@ -37,7 +37,7 @@ export const useWorkflowRunsDetails = ({
repo,
id: parseInt(id, 10),
})
- : Promise.reject('No repo/owner provided');
+ : Promise.reject(Error('No repo/owner provided'));
}, [repo, owner, id]);
return details;
};
diff --git a/plugins/github-actions/src/components/WorkflowRunLogs/WorkflowRunLogs.tsx b/plugins/github-actions/src/components/WorkflowRunLogs/WorkflowRunLogs.tsx
index 0f1670bbbc..43c1233cfb 100644
--- a/plugins/github-actions/src/components/WorkflowRunLogs/WorkflowRunLogs.tsx
+++ b/plugins/github-actions/src/components/WorkflowRunLogs/WorkflowRunLogs.tsx
@@ -83,7 +83,7 @@ export const WorkflowRunLogs = ({
const hostname = readGitHubIntegrationConfigs(
config.getOptionalConfigArray('integrations.github') ?? [],
)[0].host;
- const [owner, repo] = projectName.value ? projectName.value.split('/') : [];
+ const [owner, repo] = (projectName && projectName.split('/')) || [];
const jobLogs = useDownloadWorkflowRunLogs({
hostname,
owner,
diff --git a/plugins/github-actions/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx b/plugins/github-actions/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx
index 81fa036221..aa175caab6 100644
--- a/plugins/github-actions/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx
+++ b/plugins/github-actions/src/components/WorkflowRunsTable/WorkflowRunsTable.tsx
@@ -157,7 +157,7 @@ export const WorkflowRunsTable = ({
branch?: string;
}) => {
const config = useApi(configApiRef);
- const { value: projectName, loading } = useProjectName(entity);
+ const projectName = useProjectName(entity);
// TODO: Get github hostname from metadata annotation
const hostname = readGitHubIntegrationConfigs(
config.getOptionalConfigArray('integrations.github') ?? [],
@@ -172,7 +172,7 @@ export const WorkflowRunsTable = ({
});
const githubHost = hostname || 'github.com';
- const hasNoRuns = !loading && !tableProps.loading && !runs;
+ const hasNoRuns = !tableProps.loading && !runs;
return hasNoRuns ? (
{
- const { value, loading, error } = useAsync(async () => {
- return entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '';
- });
- return { value, loading, error };
-};
+export const useProjectName = (entity: Entity) =>
+ entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '';