fix(github-actions): use only github.com/project-slug annotation
This commit is contained in:
@@ -17,7 +17,10 @@
|
||||
// TODO(shmidt-i): move to the app
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Content } from '@backstage/core';
|
||||
import { LatestWorkflowsForBranchCard } from '@backstage/plugin-github-actions';
|
||||
import {
|
||||
LatestWorkflowsForBranchCard,
|
||||
GITHUB_ACTIONS_ANNOTATION,
|
||||
} from '@backstage/plugin-github-actions';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
@@ -25,7 +28,7 @@ export const EntityPageCi: FC<{ entity: Entity }> = ({ entity }) => {
|
||||
return (
|
||||
<Content>
|
||||
<Grid container spacing={3}>
|
||||
{entity.metadata?.annotations?.['backstage.io/github-actions-id'] && (
|
||||
{entity.metadata?.annotations?.[GITHUB_ACTIONS_ANNOTATION] && (
|
||||
<Grid item sm={12}>
|
||||
<LatestWorkflowsForBranchCard entity={entity} branch="master" />
|
||||
</Grid>
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
// TODO(shmidt-i): move to the app
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Content } from '@backstage/core';
|
||||
import { LatestWorkflowRunCard } from '@backstage/plugin-github-actions';
|
||||
import {
|
||||
LatestWorkflowRunCard,
|
||||
GITHUB_ACTIONS_ANNOTATION,
|
||||
} from '@backstage/plugin-github-actions';
|
||||
import {
|
||||
JenkinsBuildsWidget,
|
||||
JenkinsLastBuildWidget,
|
||||
@@ -47,7 +50,7 @@ export const EntityPageOverview: FC<{ entity: Entity }> = ({ entity }) => {
|
||||
<JenkinsBuildsWidget entity={entity} />
|
||||
</Grid>
|
||||
)}
|
||||
{entity.metadata?.annotations?.['backstage.io/github-actions-id'] && (
|
||||
{entity.metadata?.annotations?.[GITHUB_ACTIONS_ANNOTATION] && (
|
||||
<Grid item sm={3}>
|
||||
<LatestWorkflowRunCard entity={entity} branch="master" />
|
||||
</Grid>
|
||||
|
||||
@@ -32,6 +32,7 @@ import {
|
||||
useApi,
|
||||
} from '@backstage/core';
|
||||
import ExternalLinkIcon from '@material-ui/icons/Launch';
|
||||
import { GITHUB_ACTIONS_ANNOTATION } from '../useProjectName';
|
||||
|
||||
const useStyles = makeStyles<Theme>({
|
||||
externalLinkIcon: {
|
||||
@@ -83,7 +84,7 @@ export const LatestWorkflowRunCard = ({
|
||||
}) => {
|
||||
const errorApi = useApi(errorApiRef);
|
||||
const [owner, repo] = (
|
||||
entity?.metadata.annotations?.['backstage.io/github-actions-id'] ?? '/'
|
||||
entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '/'
|
||||
).split('/');
|
||||
const [{ runs, loading, error }] = useWorkflowRuns({
|
||||
owner,
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ metadata:
|
||||
description: {{cookiecutter.description}}
|
||||
annotations:
|
||||
github.com/project-slug: {{cookiecutter.storePath}}
|
||||
backstage.io/github-actions-id: {{cookiecutter.storePath}}
|
||||
backstage.io/techdocs-ref: github:https://github.com/{{cookiecutter.storePath}}
|
||||
spec:
|
||||
type: website
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ metadata:
|
||||
description: {{cookiecutter.description}}
|
||||
annotations:
|
||||
github.com/project-slug: {{cookiecutter.storePath}}
|
||||
backstage.io/github-actions-id: {{cookiecutter.storePath}}
|
||||
spec:
|
||||
type: service
|
||||
lifecycle: experimental
|
||||
|
||||
Reference in New Issue
Block a user