diff --git a/plugins/github-actions/src/components/Widget/Widget.tsx b/plugins/github-actions/src/components/Widget/Widget.tsx
index 031364c8ce..59e1cc5289 100644
--- a/plugins/github-actions/src/components/Widget/Widget.tsx
+++ b/plugins/github-actions/src/components/Widget/Widget.tsx
@@ -15,7 +15,7 @@
*/
import React, { useEffect } from 'react';
import { useWorkflowRuns } from '../useWorkflowRuns';
-import { WorkflowRun } from '../WorkflowRunsTable';
+import { WorkflowRun, WorkflowRunsTable } from '../WorkflowRunsTable';
import { Entity } from '@backstage/catalog-model';
import { WorkflowRunStatus } from '../WorkflowRunStatus';
import {
@@ -108,3 +108,51 @@ export const Widget = ({
);
};
+
+const RecentWorkflowRunsCardContent = ({
+ error,
+ loading,
+ branch,
+}: {
+ error?: Error;
+ loading?: boolean;
+ branch: string;
+}) => {
+ if (error) return Couldn't fetch {branch} runs;
+ if (loading) return ;
+ return ;
+};
+
+export const RecentWorkflowRunsCard = ({
+ entity,
+ branch = 'master',
+}: {
+ entity: Entity;
+ branch: string;
+}) => {
+ const errorApi = useApi(errorApiRef);
+ const [owner, repo] = (
+ entity?.metadata.annotations?.['backstage.io/github-actions-id'] ?? '/'
+ ).split('/');
+ const [{ loading, error }] = useWorkflowRuns({
+ owner,
+ repo,
+ branch,
+ });
+
+ useEffect(() => {
+ if (error) {
+ errorApi.post(error);
+ }
+ }, [error, errorApi]);
+
+ return (
+
+
+
+ );
+};
diff --git a/plugins/github-actions/src/components/Widget/index.ts b/plugins/github-actions/src/components/Widget/index.ts
index 2b34671ab5..0bd5dad98a 100644
--- a/plugins/github-actions/src/components/Widget/index.ts
+++ b/plugins/github-actions/src/components/Widget/index.ts
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export { Widget } from './Widget';
+export { Widget, RecentWorkflowRunsCard } from './Widget';