@backstage-community/plugin-github-actions 0.6.17 → 0.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +52 -2
- package/alpha/package.json +7 -0
- package/dist/alpha/apis.esm.js +15 -0
- package/dist/alpha/apis.esm.js.map +1 -0
- package/dist/alpha/entityCards.esm.js +51 -0
- package/dist/alpha/entityCards.esm.js.map +1 -0
- package/dist/alpha/entityContent.esm.js +15 -0
- package/dist/alpha/entityContent.esm.js.map +1 -0
- package/dist/alpha.d.ts +10 -0
- package/dist/alpha.esm.js +24 -0
- package/dist/alpha.esm.js.map +1 -0
- package/dist/api/GithubActionsApi.esm.js +1 -1
- package/dist/api/GithubActionsApi.esm.js.map +1 -1
- package/dist/components/Cards/Cards.esm.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/package.json +22 -7
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
Website: [https://github.com/actions](https://github.com/actions)
|
|
4
4
|
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [GitHub Actions Plugin](#github-actions-plugin)
|
|
8
|
+
- [Table of Contents](#table-of-contents)
|
|
9
|
+
- [Screenshots](#screenshots)
|
|
10
|
+
- [Setup](#setup)
|
|
11
|
+
- [Generic Requirements](#generic-requirements)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Integrating with `EntityPage`](#integrating-with-entitypage)
|
|
14
|
+
- [Integrating with `EntityPage` (New Frontend System)](#integrating-with-entitypage-new-frontend-system)
|
|
15
|
+
- [Self-hosted / Enterprise GitHub](#self-hosted--enterprise-github)
|
|
16
|
+
- [Features](#features)
|
|
17
|
+
- [Limitations](#limitations)
|
|
18
|
+
- [Optional Workflow Runs Card View](#optional-workflow-runs-card-view)
|
|
19
|
+
|
|
5
20
|
## Screenshots
|
|
6
21
|
|
|
7
22
|
TBD
|
|
@@ -33,7 +48,7 @@ TBD
|
|
|
33
48
|
owner: user:guest
|
|
34
49
|
```
|
|
35
50
|
|
|
36
|
-
###
|
|
51
|
+
### Installation
|
|
37
52
|
|
|
38
53
|
1. Install the plugin dependency in your Backstage app package:
|
|
39
54
|
|
|
@@ -42,7 +57,9 @@ TBD
|
|
|
42
57
|
yarn --cwd packages/app add @backstage-community/plugin-github-actions
|
|
43
58
|
```
|
|
44
59
|
|
|
45
|
-
|
|
60
|
+
### Integrating with `EntityPage`
|
|
61
|
+
|
|
62
|
+
1. Add to the app `EntityPage` component:
|
|
46
63
|
|
|
47
64
|
```tsx
|
|
48
65
|
// In packages/app/src/components/catalog/EntityPage.tsx
|
|
@@ -64,6 +81,39 @@ const serviceEntityPage = (
|
|
|
64
81
|
3. Run the app with `yarn start` and the backend with `yarn start-backend`.
|
|
65
82
|
Then navigate to `/github-actions/` under any entity.
|
|
66
83
|
|
|
84
|
+
### Integrating with `EntityPage` (New Frontend System)
|
|
85
|
+
|
|
86
|
+
Follow this section if you are using Backstage's [new frontend system](https://backstage.io/docs/frontend-system/).
|
|
87
|
+
|
|
88
|
+
1. Import `githubActionsPlugin` in your `App.tsx` and add it to your app's `features` array:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import githubActionsPlugin from '@backstage-community/plugin-github-actions/alpha';
|
|
92
|
+
|
|
93
|
+
// ...
|
|
94
|
+
|
|
95
|
+
export const app = createApp({
|
|
96
|
+
features: [
|
|
97
|
+
// ...
|
|
98
|
+
githubActionsPlugin,
|
|
99
|
+
// ...
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
2. Next, enable your desired extensions in `app-config.yaml`
|
|
105
|
+
|
|
106
|
+
```yaml
|
|
107
|
+
app:
|
|
108
|
+
extensions:
|
|
109
|
+
- entity-content:github-actions/entity
|
|
110
|
+
- entity-card:github-actions/latest-workflow-run
|
|
111
|
+
- entity-card:github-actions/latest-branch-workflow-runs
|
|
112
|
+
- entity-card:github-actions/recent-workflow-runs
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
3. Whichever extensions you've enabled should now appear in your entity page.
|
|
116
|
+
|
|
67
117
|
### Self-hosted / Enterprise GitHub
|
|
68
118
|
|
|
69
119
|
The plugin will try to use `backstage.io/source-location` or `backstage.io/managed-by-location`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createApiExtension, createApiFactory, configApiRef } from '@backstage/frontend-plugin-api';
|
|
2
|
+
import { scmAuthApiRef } from '@backstage/integration-react';
|
|
3
|
+
import { githubActionsApiRef } from '../api/GithubActionsApi.esm.js';
|
|
4
|
+
import { GithubActionsClient } from '../api/GithubActionsClient.esm.js';
|
|
5
|
+
|
|
6
|
+
const githubActionsApi = createApiExtension({
|
|
7
|
+
factory: createApiFactory({
|
|
8
|
+
api: githubActionsApiRef,
|
|
9
|
+
deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },
|
|
10
|
+
factory: ({ configApi, scmAuthApi }) => new GithubActionsClient({ configApi, scmAuthApi })
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { githubActionsApi };
|
|
15
|
+
//# sourceMappingURL=apis.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apis.esm.js","sources":["../../src/alpha/apis.ts"],"sourcesContent":["import {\n configApiRef,\n createApiExtension,\n createApiFactory,\n} from '@backstage/frontend-plugin-api';\nimport { scmAuthApiRef } from '@backstage/integration-react';\nimport { githubActionsApiRef, GithubActionsClient } from '../api';\n\n/**\n * @alpha\n */\nexport const githubActionsApi = createApiExtension({\n factory: createApiFactory({\n api: githubActionsApiRef,\n deps: { configApi: configApiRef, scmAuthApi: scmAuthApiRef },\n factory: ({ configApi, scmAuthApi }) =>\n new GithubActionsClient({ configApi, scmAuthApi }),\n }),\n});\n"],"names":[],"mappings":";;;;;AAWO,MAAM,mBAAmB,kBAAmB,CAAA;AAAA,EACjD,SAAS,gBAAiB,CAAA;AAAA,IACxB,GAAK,EAAA,mBAAA;AAAA,IACL,IAAM,EAAA,EAAE,SAAW,EAAA,YAAA,EAAc,YAAY,aAAc,EAAA;AAAA,IAC3D,OAAA,EAAS,CAAC,EAAE,SAAW,EAAA,UAAA,EACrB,KAAA,IAAI,mBAAoB,CAAA,EAAE,SAAW,EAAA,UAAA,EAAY,CAAA;AAAA,GACpD,CAAA;AACH,CAAC;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createSchemaFromZod } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha';
|
|
4
|
+
|
|
5
|
+
const entityGithubActionsCard = createEntityCardExtension({
|
|
6
|
+
name: "workflow-runs",
|
|
7
|
+
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.Router, { view: "cards" }))
|
|
8
|
+
});
|
|
9
|
+
const entityLatestGithubActionRunCard = createEntityCardExtension({
|
|
10
|
+
name: "latest-workflow-run",
|
|
11
|
+
configSchema: createSchemaFromZod(
|
|
12
|
+
(z) => z.object({
|
|
13
|
+
props: z.object({
|
|
14
|
+
branch: z.string().default("master")
|
|
15
|
+
}).default({}),
|
|
16
|
+
filter: z.string().optional()
|
|
17
|
+
})
|
|
18
|
+
),
|
|
19
|
+
loader: ({ config }) => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.LatestWorkflowRunCard, { ...config.props }))
|
|
20
|
+
});
|
|
21
|
+
const entityLatestGithubActionsForBranchCard = createEntityCardExtension(
|
|
22
|
+
{
|
|
23
|
+
name: "latest-branch-workflow-runs",
|
|
24
|
+
configSchema: createSchemaFromZod(
|
|
25
|
+
(z) => z.object({
|
|
26
|
+
props: z.object({
|
|
27
|
+
branch: z.string().default("master")
|
|
28
|
+
}).default({}),
|
|
29
|
+
filter: z.string().optional()
|
|
30
|
+
})
|
|
31
|
+
),
|
|
32
|
+
loader: ({ config }) => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.LatestWorkflowsForBranchCard, { ...config.props }))
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const entityRecentGithubActionsRunsCard = createEntityCardExtension({
|
|
36
|
+
name: "recent-workflow-runs",
|
|
37
|
+
configSchema: createSchemaFromZod(
|
|
38
|
+
(z) => z.object({
|
|
39
|
+
props: z.object({
|
|
40
|
+
branch: z.string().default("master"),
|
|
41
|
+
dense: z.boolean().default(false),
|
|
42
|
+
limit: z.number().default(5).optional()
|
|
43
|
+
}).default({}),
|
|
44
|
+
filter: z.string().optional()
|
|
45
|
+
})
|
|
46
|
+
),
|
|
47
|
+
loader: ({ config }) => import('../components/Cards/index.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.RecentWorkflowRunsCard, { ...config.props }))
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export { entityGithubActionsCard, entityLatestGithubActionRunCard, entityLatestGithubActionsForBranchCard, entityRecentGithubActionsRunsCard };
|
|
51
|
+
//# sourceMappingURL=entityCards.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityCards.esm.js","sources":["../../src/alpha/entityCards.tsx"],"sourcesContent":["import React from 'react';\nimport { createSchemaFromZod } from '@backstage/frontend-plugin-api';\nimport { createEntityCardExtension } from '@backstage/plugin-catalog-react/alpha';\n\n/**\n * @alpha\n */\nexport const entityGithubActionsCard = createEntityCardExtension({\n name: 'workflow-runs',\n loader: () =>\n import('../components/Router').then(m => <m.Router view=\"cards\" />),\n});\n\n/**\n * @alpha\n */\nexport const entityLatestGithubActionRunCard = createEntityCardExtension({\n name: 'latest-workflow-run',\n configSchema: createSchemaFromZod(z =>\n z.object({\n props: z\n .object({\n branch: z.string().default('master'),\n })\n .default({}),\n filter: z.string().optional(),\n }),\n ),\n loader: ({ config }) =>\n import('../components/Cards').then(m => (\n <m.LatestWorkflowRunCard {...config.props} />\n )),\n});\n\n/**\n * @alpha\n */\nexport const entityLatestGithubActionsForBranchCard = createEntityCardExtension(\n {\n name: 'latest-branch-workflow-runs',\n configSchema: createSchemaFromZod(z =>\n z.object({\n props: z\n .object({\n branch: z.string().default('master'),\n })\n .default({}),\n filter: z.string().optional(),\n }),\n ),\n loader: ({ config }) =>\n import('../components/Cards').then(m => (\n <m.LatestWorkflowsForBranchCard {...config.props} />\n )),\n },\n);\n\n/**\n * @alpha\n */\nexport const entityRecentGithubActionsRunsCard = createEntityCardExtension({\n name: 'recent-workflow-runs',\n configSchema: createSchemaFromZod(z =>\n z.object({\n props: z\n .object({\n branch: z.string().default('master'),\n dense: z.boolean().default(false),\n limit: z.number().default(5).optional(),\n })\n .default({}),\n filter: z.string().optional(),\n }),\n ),\n loader: ({ config }) =>\n import('../components/Cards').then(m => (\n <m.RecentWorkflowRunsCard {...config.props} />\n )),\n});\n"],"names":[],"mappings":";;;;AAOO,MAAM,0BAA0B,yBAA0B,CAAA;AAAA,EAC/D,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA,MACN,OAAO,6BAAsB,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE,CAAA;AACtE,CAAC,EAAA;AAKM,MAAM,kCAAkC,yBAA0B,CAAA;AAAA,EACvE,IAAM,EAAA,qBAAA;AAAA,EACN,YAAc,EAAA,mBAAA;AAAA,IAAoB,CAAA,CAAA,KAChC,EAAE,MAAO,CAAA;AAAA,MACP,KAAA,EAAO,EACJ,MAAO,CAAA;AAAA,QACN,MAAQ,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,QAAQ,CAAA;AAAA,OACpC,CAAA,CACA,OAAQ,CAAA,EAAE,CAAA;AAAA,MACb,MAAQ,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAS,EAAA;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AAE,QAAS,EAAA;AAAA,OACvC,CAAA,CACA,OAAQ,CAAA,EAAE,CAAA;AAAA,MACb,MAAQ,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAS,EAAA;AAAA,KAC7B,CAAA;AAAA,GACH;AAAA,EACA,QAAQ,CAAC,EAAE,MAAO,EAAA,KAChB,OAAO,kCAAqB,CAAA,CAAE,IAAK,CAAA,CAAA,CAAA,yCAChC,CAAE,CAAA,sBAAA,EAAF,EAA0B,GAAG,MAAA,CAAO,OAAO,CAC7C,CAAA;AACL,CAAC;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { convertLegacyRouteRef } from '@backstage/core-compat-api';
|
|
3
|
+
import { createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';
|
|
4
|
+
import { rootRouteRef } from '../routes.esm.js';
|
|
5
|
+
|
|
6
|
+
const entityGithubActionsContent = createEntityContentExtension({
|
|
7
|
+
defaultPath: "github-actions",
|
|
8
|
+
defaultTitle: "GitHub Actions",
|
|
9
|
+
name: "entity",
|
|
10
|
+
routeRef: convertLegacyRouteRef(rootRouteRef),
|
|
11
|
+
loader: () => import('../components/Router.esm.js').then((m) => /* @__PURE__ */ React.createElement(m.Router, { view: "table" }))
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { entityGithubActionsContent };
|
|
15
|
+
//# sourceMappingURL=entityContent.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityContent.esm.js","sources":["../../src/alpha/entityContent.tsx"],"sourcesContent":["import React from 'react';\nimport { convertLegacyRouteRef } from '@backstage/core-compat-api';\nimport { createEntityContentExtension } from '@backstage/plugin-catalog-react/alpha';\nimport { rootRouteRef } from '../routes';\n\n/**\n * @alpha\n */\nexport const entityGithubActionsContent = createEntityContentExtension({\n defaultPath: 'github-actions',\n defaultTitle: 'GitHub Actions',\n name: 'entity',\n routeRef: convertLegacyRouteRef(rootRouteRef),\n loader: () =>\n import('../components/Router').then(m => <m.Router view=\"table\" />),\n});\n"],"names":[],"mappings":";;;;;AAQO,MAAM,6BAA6B,4BAA6B,CAAA;AAAA,EACrE,WAAa,EAAA,gBAAA;AAAA,EACb,YAAc,EAAA,gBAAA;AAAA,EACd,IAAM,EAAA,QAAA;AAAA,EACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,EAC5C,MAAQ,EAAA,MACN,OAAO,6BAAsB,CAAE,CAAA,IAAA,CAAK,CAAK,CAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,CAAE,CAAA,MAAA,EAAF,EAAS,IAAA,EAAK,SAAQ,CAAE,CAAA;AACtE,CAAC;;;;"}
|
package/dist/alpha.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
|
|
7
|
+
entityContent: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
8
|
+
}, {}>;
|
|
9
|
+
|
|
10
|
+
export { _default as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { convertLegacyRouteRefs } from '@backstage/core-compat-api';
|
|
2
|
+
import { createPlugin } from '@backstage/frontend-plugin-api';
|
|
3
|
+
import { githubActionsApi } from './alpha/apis.esm.js';
|
|
4
|
+
import { entityGithubActionsCard, entityLatestGithubActionRunCard, entityLatestGithubActionsForBranchCard, entityRecentGithubActionsRunsCard } from './alpha/entityCards.esm.js';
|
|
5
|
+
import { entityGithubActionsContent } from './alpha/entityContent.esm.js';
|
|
6
|
+
import { rootRouteRef } from './routes.esm.js';
|
|
7
|
+
|
|
8
|
+
var alpha = createPlugin({
|
|
9
|
+
id: "github-actions",
|
|
10
|
+
routes: convertLegacyRouteRefs({
|
|
11
|
+
entityContent: rootRouteRef
|
|
12
|
+
}),
|
|
13
|
+
extensions: [
|
|
14
|
+
entityGithubActionsContent,
|
|
15
|
+
entityGithubActionsCard,
|
|
16
|
+
entityLatestGithubActionRunCard,
|
|
17
|
+
entityLatestGithubActionsForBranchCard,
|
|
18
|
+
entityRecentGithubActionsRunsCard,
|
|
19
|
+
githubActionsApi
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { alpha as default };
|
|
24
|
+
//# sourceMappingURL=alpha.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.ts"],"sourcesContent":["import { convertLegacyRouteRefs } from '@backstage/core-compat-api';\nimport { createPlugin } from '@backstage/frontend-plugin-api';\nimport {\n entityGithubActionsCard,\n entityGithubActionsContent,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n} from './alpha/index';\nimport { rootRouteRef } from './routes';\n\n/**\n * @alpha\n */\nexport default createPlugin({\n id: 'github-actions',\n routes: convertLegacyRouteRefs({\n entityContent: rootRouteRef,\n }),\n extensions: [\n entityGithubActionsContent,\n entityGithubActionsCard,\n entityLatestGithubActionRunCard,\n entityLatestGithubActionsForBranchCard,\n entityRecentGithubActionsRunsCard,\n githubActionsApi,\n ],\n});\n"],"names":[],"mappings":";;;;;;;AAeA,YAAe,YAAa,CAAA;AAAA,EAC1B,EAAI,EAAA,gBAAA;AAAA,EACJ,QAAQ,sBAAuB,CAAA;AAAA,IAC7B,aAAe,EAAA,YAAA;AAAA,GAChB,CAAA;AAAA,EACD,UAAY,EAAA;AAAA,IACV,0BAAA;AAAA,IACA,uBAAA;AAAA,IACA,+BAAA;AAAA,IACA,sCAAA;AAAA,IACA,iCAAA;AAAA,IACA,gBAAA;AAAA,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubActionsApi.esm.js","sources":["../../src/api/GithubActionsApi.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"GithubActionsApi.esm.js","sources":["../../src/api/GithubActionsApi.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createApiRef } from '@backstage/frontend-plugin-api';\nimport { RestEndpointMethodTypes } from '@octokit/rest';\n\n/** @public */\nexport const githubActionsApiRef = createApiRef<GithubActionsApi>({\n id: 'plugin.githubactions.service',\n});\n\n/**\n * A client for fetching information about GitHub actions.\n *\n * @public\n */\nexport type GithubActionsApi = {\n listWorkflowRuns: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n pageSize?: number;\n page?: number;\n branch?: string;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']\n >;\n\n getWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']\n >;\n\n getWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']\n >;\n\n reRunWorkflow: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<any>;\n\n listJobsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n id: number;\n pageSize?: number;\n page?: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']\n >;\n\n downloadJobLogsForWorkflowRun: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n runId: number;\n }) => Promise<\n RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']\n >;\n\n listBranches: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n page: number;\n }) => Promise<\n RestEndpointMethodTypes['repos']['listBranches']['response']['data']\n >;\n\n getDefaultBranch: (options: {\n hostname?: string;\n owner: string;\n repo: string;\n }) => Promise<\n RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']\n >;\n};\n"],"names":[],"mappings":";;AAoBO,MAAM,sBAAsB,YAA+B,CAAA;AAAA,EAChE,EAAI,EAAA,8BAAA;AACN,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cards.esm.js","sources":["../../../src/components/Cards/Cards.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport React, { useEffect } from 'react';\nimport { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunsTable } from '../WorkflowRunsTable';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n StructuredMetadataTable,\n} from '@backstage/core-components';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles({\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'bottom',\n },\n});\n\nconst WidgetContent = (props: {\n error?: Error;\n loading?: boolean;\n lastRun: WorkflowRun;\n branch: string;\n}) => {\n const { error, loading, lastRun, branch } = props;\n const classes = useStyles();\n\n if (error) return <Typography>Couldn't fetch latest {branch} run</Typography>;\n if (loading) return <LinearProgress />;\n\n return (\n <StructuredMetadataTable\n metadata={{\n status: (\n <>\n <WorkflowRunStatus\n status={lastRun.status}\n conclusion={lastRun.conclusion}\n />\n </>\n ),\n message: lastRun.message,\n url: (\n <Link to={lastRun.githubUrl ?? ''}>\n See more on GitHub{' '}\n <ExternalLinkIcon className={classes.externalLinkIcon} />\n </Link>\n ),\n }}\n />\n );\n};\n\n/** @public */\nexport const LatestWorkflowRunCard = (props: {\n branch
|
|
1
|
+
{"version":3,"file":"Cards.esm.js","sources":["../../../src/components/Cards/Cards.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport ExternalLinkIcon from '@material-ui/icons/Launch';\nimport React, { useEffect } from 'react';\nimport { GITHUB_ACTIONS_ANNOTATION } from '../getProjectNameFromEntity';\nimport { useWorkflowRuns, WorkflowRun } from '../useWorkflowRuns';\nimport { WorkflowRunsTable } from '../WorkflowRunsTable';\nimport { WorkflowRunStatus } from '../WorkflowRunStatus';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n InfoCard,\n InfoCardVariants,\n Link,\n StructuredMetadataTable,\n} from '@backstage/core-components';\nimport { getHostnameFromEntity } from '../getHostnameFromEntity';\n\nconst useStyles = makeStyles({\n externalLinkIcon: {\n fontSize: 'inherit',\n verticalAlign: 'bottom',\n },\n});\n\nconst WidgetContent = (props: {\n error?: Error;\n loading?: boolean;\n lastRun: WorkflowRun;\n branch: string;\n}) => {\n const { error, loading, lastRun, branch } = props;\n const classes = useStyles();\n\n if (error) return <Typography>Couldn't fetch latest {branch} run</Typography>;\n if (loading) return <LinearProgress />;\n\n return (\n <StructuredMetadataTable\n metadata={{\n status: (\n <>\n <WorkflowRunStatus\n status={lastRun.status}\n conclusion={lastRun.conclusion}\n />\n </>\n ),\n message: lastRun.message,\n url: (\n <Link to={lastRun.githubUrl ?? ''}>\n See more on GitHub{' '}\n <ExternalLinkIcon className={classes.externalLinkIcon} />\n </Link>\n ),\n }}\n />\n );\n};\n\n/** @public */\nexport const LatestWorkflowRunCard = (props: {\n branch?: string;\n variant?: InfoCardVariants;\n}) => {\n const { branch = 'master', variant } = props;\n const { entity } = useEntity();\n const errorApi = useApi(errorApiRef);\n const hostname = getHostnameFromEntity(entity);\n const [owner, repo] = (\n entity?.metadata.annotations?.[GITHUB_ACTIONS_ANNOTATION] ?? '/'\n ).split('/');\n const [{ runs, loading, error }] = useWorkflowRuns({\n hostname,\n owner,\n repo,\n branch,\n });\n const lastRun = runs?.[0] ?? ({} as WorkflowRun);\n useEffect(() => {\n if (error) {\n errorApi.post(error);\n }\n }, [error, errorApi]);\n\n return (\n <InfoCard title={`Last ${branch} build`} variant={variant}>\n <WidgetContent\n error={error}\n loading={loading}\n branch={branch}\n lastRun={lastRun}\n />\n </InfoCard>\n );\n};\n\n/** @public */\nexport const LatestWorkflowsForBranchCard = (props: {\n branch?: string;\n variant?: InfoCardVariants;\n}) => {\n const { branch = 'master', variant } = props;\n const { entity } = useEntity();\n\n return (\n <InfoCard title={`Last ${branch} build`} variant={variant}>\n <WorkflowRunsTable branch={branch} entity={entity} />\n </InfoCard>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAmCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,SAAA;AAAA,IACV,aAAe,EAAA,QAAA;AAAA,GACjB;AACF,CAAC,CAAA,CAAA;AAED,MAAM,aAAA,GAAgB,CAAC,KAKjB,KAAA;AACJ,EAAA,MAAM,EAAE,KAAA,EAAO,OAAS,EAAA,OAAA,EAAS,QAAW,GAAA,KAAA,CAAA;AAC5C,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,IAAI,OAAc,uBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,IAAA,EAAA,wBAAA,EAAuB,QAAO,MAAI,CAAA,CAAA;AAChE,EAAI,IAAA,OAAA,EAAgB,uBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,CAAA,CAAA;AAEpC,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA;AAAA,QACR,wBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,iBAAA;AAAA,UAAA;AAAA,YACC,QAAQ,OAAQ,CAAA,MAAA;AAAA,YAChB,YAAY,OA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AQ,CAAC,CAAA,CAAA;AAEpB,EAAA,2CACG,QAAS,EAAA,EAAA,KAAA,EAAO,CAAQ,KAAA,EAAA,MAAM,UAAU,OACvC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ,EAAA;AAGa,MAAA,4BAAA,GAA+B,CAAC,KAGvC,KAAA;AACJ,EAAA,MAAM,EAAE,MAAA,GAAS,QAAU,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AACvC,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAO,CAAQ,KAAA,EAAA,MAAM,CAAU,MAAA,CAAA,EAAA,OAAA,EAAA,kBACtC,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,MAAgB,EAAA,MAAA,EAAgB,CACrD,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -190,12 +190,12 @@ declare const githubActionsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
|
190
190
|
declare const EntityGithubActionsContent: (props: RouterProps) => react.JSX.Element;
|
|
191
191
|
/** @public */
|
|
192
192
|
declare const EntityLatestGithubActionRunCard: (props: {
|
|
193
|
-
branch
|
|
193
|
+
branch?: string | undefined;
|
|
194
194
|
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
195
195
|
}) => react.JSX.Element;
|
|
196
196
|
/** @public */
|
|
197
197
|
declare const EntityLatestGithubActionsForBranchCard: (props: {
|
|
198
|
-
branch
|
|
198
|
+
branch?: string | undefined;
|
|
199
199
|
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
200
200
|
}) => react.JSX.Element;
|
|
201
201
|
/** @public */
|
|
@@ -213,12 +213,12 @@ declare const Router: (props: RouterProps) => react__default.JSX.Element;
|
|
|
213
213
|
|
|
214
214
|
/** @public */
|
|
215
215
|
declare const LatestWorkflowRunCard: (props: {
|
|
216
|
-
branch
|
|
216
|
+
branch?: string;
|
|
217
217
|
variant?: InfoCardVariants;
|
|
218
218
|
}) => react__default.JSX.Element;
|
|
219
219
|
/** @public */
|
|
220
220
|
declare const LatestWorkflowsForBranchCard: (props: {
|
|
221
|
-
branch
|
|
221
|
+
branch?: string;
|
|
222
222
|
variant?: InfoCardVariants;
|
|
223
223
|
}) => react__default.JSX.Element;
|
|
224
224
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-github-actions",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.18",
|
|
4
4
|
"description": "A Backstage plugin that integrates towards GitHub Actions",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -10,9 +10,20 @@
|
|
|
10
10
|
]
|
|
11
11
|
},
|
|
12
12
|
"publishConfig": {
|
|
13
|
-
"access": "public"
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.esm.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.esm.js"
|
|
20
|
+
},
|
|
21
|
+
"./alpha": {
|
|
22
|
+
"import": "./dist/alpha.esm.js",
|
|
23
|
+
"types": "./dist/alpha.d.ts",
|
|
24
|
+
"default": "./dist/alpha.esm.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
16
27
|
},
|
|
17
28
|
"keywords": [
|
|
18
29
|
"backstage",
|
|
@@ -27,10 +38,11 @@
|
|
|
27
38
|
},
|
|
28
39
|
"license": "Apache-2.0",
|
|
29
40
|
"sideEffects": false,
|
|
30
|
-
"main": "dist/index.esm.js",
|
|
31
|
-
"types": "dist/index.d.ts",
|
|
41
|
+
"main": "./dist/index.esm.js",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
32
43
|
"files": [
|
|
33
|
-
"dist"
|
|
44
|
+
"dist",
|
|
45
|
+
"alpha"
|
|
34
46
|
],
|
|
35
47
|
"scripts": {
|
|
36
48
|
"build": "backstage-cli package build",
|
|
@@ -43,8 +55,10 @@
|
|
|
43
55
|
},
|
|
44
56
|
"dependencies": {
|
|
45
57
|
"@backstage/catalog-model": "^1.5.0",
|
|
58
|
+
"@backstage/core-compat-api": "^0.2.7",
|
|
46
59
|
"@backstage/core-components": "^0.14.9",
|
|
47
60
|
"@backstage/core-plugin-api": "^1.9.3",
|
|
61
|
+
"@backstage/frontend-plugin-api": "^0.6.7",
|
|
48
62
|
"@backstage/integration": "^1.13.0",
|
|
49
63
|
"@backstage/integration-react": "^1.1.29",
|
|
50
64
|
"@backstage/plugin-catalog-react": "^1.12.2",
|
|
@@ -61,6 +75,7 @@
|
|
|
61
75
|
"@backstage/cli": "^0.26.11",
|
|
62
76
|
"@backstage/core-app-api": "^1.14.0",
|
|
63
77
|
"@backstage/dev-utils": "^1.0.35",
|
|
78
|
+
"@backstage/frontend-test-utils": "^0.1.10",
|
|
64
79
|
"@backstage/test-utils": "^1.5.8",
|
|
65
80
|
"@testing-library/dom": "^10.0.0",
|
|
66
81
|
"@testing-library/jest-dom": "^6.0.0",
|