@backstage-community/plugin-github-actions 0.6.16
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 +2155 -0
- package/README.md +110 -0
- package/dist/esm/index-CRpdBPJi.esm.js +50 -0
- package/dist/esm/index-CRpdBPJi.esm.js.map +1 -0
- package/dist/index.d.ts +236 -0
- package/dist/index.esm.js +1238 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# GitHub Actions Plugin
|
|
2
|
+
|
|
3
|
+
Website: [https://github.com/actions](https://github.com/actions)
|
|
4
|
+
|
|
5
|
+
## Screenshots
|
|
6
|
+
|
|
7
|
+
TBD
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
### Generic Requirements
|
|
12
|
+
|
|
13
|
+
1. Provide OAuth credentials:
|
|
14
|
+
1. [Create an OAuth App](https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/) in the GitHub organization with the callback URL set to `http://localhost:7007/api/auth/github/handler/frame`.
|
|
15
|
+
2. Take the Client ID and Client Secret from the newly created app's settings page and put them into `AUTH_GITHUB_CLIENT_ID` and `AUTH_GITHUB_CLIENT_SECRET` environment variables.
|
|
16
|
+
2. Annotate your component with a correct GitHub Actions repository and owner:
|
|
17
|
+
|
|
18
|
+
The annotation key is `github.com/project-slug`.
|
|
19
|
+
|
|
20
|
+
Example:
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
apiVersion: backstage.io/v1alpha1
|
|
24
|
+
kind: Component
|
|
25
|
+
metadata:
|
|
26
|
+
name: backstage
|
|
27
|
+
description: backstage.io
|
|
28
|
+
annotations:
|
|
29
|
+
github.com/project-slug: 'backstage/backstage'
|
|
30
|
+
spec:
|
|
31
|
+
type: website
|
|
32
|
+
lifecycle: production
|
|
33
|
+
owner: user:guest
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Standalone app requirements
|
|
37
|
+
|
|
38
|
+
1. Install the plugin dependency in your Backstage app package:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# From your Backstage root directory
|
|
42
|
+
yarn --cwd packages/app add @backstage-community/plugin-github-actions
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
2. Add to the app `EntityPage` component:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// In packages/app/src/components/catalog/EntityPage.tsx
|
|
49
|
+
import {
|
|
50
|
+
EntityGithubActionsContent,
|
|
51
|
+
isGithubActionsAvailable,
|
|
52
|
+
} from '@backstage-community/plugin-github-actions';
|
|
53
|
+
|
|
54
|
+
// You can add the tab to any number of pages, the service page is shown as an
|
|
55
|
+
// example here
|
|
56
|
+
const serviceEntityPage = (
|
|
57
|
+
<EntityLayout>
|
|
58
|
+
{/* other tabs... */}
|
|
59
|
+
<EntityLayout.Route path="/github-actions" title="GitHub Actions">
|
|
60
|
+
<EntityGithubActionsContent />
|
|
61
|
+
</EntityLayout.Route>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
3. Run the app with `yarn start` and the backend with `yarn start-backend`.
|
|
65
|
+
Then navigate to `/github-actions/` under any entity.
|
|
66
|
+
|
|
67
|
+
### Self-hosted / Enterprise GitHub
|
|
68
|
+
|
|
69
|
+
The plugin will try to use `backstage.io/source-location` or `backstage.io/managed-by-location`
|
|
70
|
+
annotations to figure out the location of the source code.
|
|
71
|
+
|
|
72
|
+
1. Add the `host` and `apiBaseUrl` to your `app-config.yaml`
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
# app-config.yaml
|
|
76
|
+
|
|
77
|
+
integrations:
|
|
78
|
+
github:
|
|
79
|
+
- host: 'your-github-host.com'
|
|
80
|
+
apiBaseUrl: 'https://api.your-github-host.com'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
- List workflow runs for a project
|
|
86
|
+
- Dive into one run to see a job steps
|
|
87
|
+
- Retry runs
|
|
88
|
+
- Pagination for runs
|
|
89
|
+
|
|
90
|
+
## Limitations
|
|
91
|
+
|
|
92
|
+
- There is a limit of 100 apps for one OAuth client/token pair
|
|
93
|
+
- The OAuth application must be at the GitHub organization level in order to display the workflows. If you do
|
|
94
|
+
not see any workflows, confirm the OAuth application was created in the organization and not a specific user account.
|
|
95
|
+
|
|
96
|
+
## Optional Workflow Runs Card View
|
|
97
|
+
|
|
98
|
+
Github Workflow Runs optional UI to show in Card view instead of table, with branch selection option
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
|
|
102
|
+
// You can add the tab to any number of pages, the service page is shown as an
|
|
103
|
+
// example given here
|
|
104
|
+
const serviceEntityPage = (
|
|
105
|
+
<EntityLayout>
|
|
106
|
+
{/* other tabs... */}
|
|
107
|
+
<EntityLayout.Route path="/github-actions" title="GitHub Actions">
|
|
108
|
+
<EntityGithubActionsContent view='cards' />
|
|
109
|
+
</EntityLayout.Route>
|
|
110
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export { LatestWorkflowRunCard, LatestWorkflowsForBranchCard, RecentWorkflowRunsCard } from '../index.esm.js';
|
|
2
|
+
import '@backstage/core-plugin-api';
|
|
3
|
+
import '@backstage/integration';
|
|
4
|
+
import '@octokit/rest';
|
|
5
|
+
import '@backstage/integration-react';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@backstage/plugin-catalog-react';
|
|
8
|
+
import 'react-router-dom';
|
|
9
|
+
import '@material-ui/core/Accordion';
|
|
10
|
+
import '@material-ui/core/AccordionDetails';
|
|
11
|
+
import '@material-ui/core/AccordionSummary';
|
|
12
|
+
import '@material-ui/core/Box';
|
|
13
|
+
import '@material-ui/core/CircularProgress';
|
|
14
|
+
import '@material-ui/core/LinearProgress';
|
|
15
|
+
import '@material-ui/core/ListItemText';
|
|
16
|
+
import '@material-ui/core/Paper';
|
|
17
|
+
import '@material-ui/core/Table';
|
|
18
|
+
import '@material-ui/core/TableBody';
|
|
19
|
+
import '@material-ui/core/TableCell';
|
|
20
|
+
import '@material-ui/core/TableContainer';
|
|
21
|
+
import '@material-ui/core/TableRow';
|
|
22
|
+
import '@material-ui/core/Typography';
|
|
23
|
+
import '@material-ui/core/styles';
|
|
24
|
+
import '@material-ui/icons/ExpandMore';
|
|
25
|
+
import '@material-ui/icons/Launch';
|
|
26
|
+
import 'luxon';
|
|
27
|
+
import '@backstage/core-components';
|
|
28
|
+
import 'react-use/esm/useAsync';
|
|
29
|
+
import '@material-ui/core/Fade';
|
|
30
|
+
import '@material-ui/core/Modal';
|
|
31
|
+
import '@material-ui/core/Tooltip';
|
|
32
|
+
import '@material-ui/core/Zoom';
|
|
33
|
+
import '@material-ui/icons/Description';
|
|
34
|
+
import '@backstage/catalog-model';
|
|
35
|
+
import 'git-url-parse';
|
|
36
|
+
import '@material-ui/core/IconButton';
|
|
37
|
+
import '@material-ui/core/Button';
|
|
38
|
+
import '@material-ui/core/Chip';
|
|
39
|
+
import '@material-ui/core/ButtonGroup';
|
|
40
|
+
import '@material-ui/core/Grid';
|
|
41
|
+
import '@material-ui/core/TablePagination';
|
|
42
|
+
import '@material-ui/core/Select';
|
|
43
|
+
import '@material-ui/core/MenuItem';
|
|
44
|
+
import '@material-ui/core/TextField';
|
|
45
|
+
import '@material-ui/icons/GitHub';
|
|
46
|
+
import '@material-ui/icons/Replay';
|
|
47
|
+
import '@material-ui/icons/Sync';
|
|
48
|
+
import 'react-use/esm/useAsyncRetry';
|
|
49
|
+
import '@material-ui/lab/Alert';
|
|
50
|
+
//# sourceMappingURL=index-CRpdBPJi.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CRpdBPJi.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as _backstage_core_components from '@backstage/core-components';
|
|
3
|
+
import { InfoCardVariants } from '@backstage/core-components';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import react__default from 'react';
|
|
6
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
7
|
+
import { ConfigApi } from '@backstage/core-plugin-api';
|
|
8
|
+
import { RestEndpointMethodTypes } from '@octokit/rest';
|
|
9
|
+
import { ScmAuthApi } from '@backstage/integration-react';
|
|
10
|
+
import { Entity } from '@backstage/catalog-model';
|
|
11
|
+
|
|
12
|
+
/** @public */
|
|
13
|
+
declare const githubActionsApiRef: _backstage_core_plugin_api.ApiRef<GithubActionsApi>;
|
|
14
|
+
/**
|
|
15
|
+
* A client for fetching information about GitHub actions.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
type GithubActionsApi = {
|
|
20
|
+
listWorkflowRuns: (options: {
|
|
21
|
+
hostname?: string;
|
|
22
|
+
owner: string;
|
|
23
|
+
repo: string;
|
|
24
|
+
pageSize?: number;
|
|
25
|
+
page?: number;
|
|
26
|
+
branch?: string;
|
|
27
|
+
}) => Promise<RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']>;
|
|
28
|
+
getWorkflow: (options: {
|
|
29
|
+
hostname?: string;
|
|
30
|
+
owner: string;
|
|
31
|
+
repo: string;
|
|
32
|
+
id: number;
|
|
33
|
+
}) => Promise<RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']>;
|
|
34
|
+
getWorkflowRun: (options: {
|
|
35
|
+
hostname?: string;
|
|
36
|
+
owner: string;
|
|
37
|
+
repo: string;
|
|
38
|
+
id: number;
|
|
39
|
+
}) => Promise<RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']>;
|
|
40
|
+
reRunWorkflow: (options: {
|
|
41
|
+
hostname?: string;
|
|
42
|
+
owner: string;
|
|
43
|
+
repo: string;
|
|
44
|
+
runId: number;
|
|
45
|
+
}) => Promise<any>;
|
|
46
|
+
listJobsForWorkflowRun: (options: {
|
|
47
|
+
hostname?: string;
|
|
48
|
+
owner: string;
|
|
49
|
+
repo: string;
|
|
50
|
+
id: number;
|
|
51
|
+
pageSize?: number;
|
|
52
|
+
page?: number;
|
|
53
|
+
}) => Promise<RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']>;
|
|
54
|
+
downloadJobLogsForWorkflowRun: (options: {
|
|
55
|
+
hostname?: string;
|
|
56
|
+
owner: string;
|
|
57
|
+
repo: string;
|
|
58
|
+
runId: number;
|
|
59
|
+
}) => Promise<RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']>;
|
|
60
|
+
listBranches: (options: {
|
|
61
|
+
hostname?: string;
|
|
62
|
+
owner: string;
|
|
63
|
+
repo: string;
|
|
64
|
+
page: number;
|
|
65
|
+
}) => Promise<RestEndpointMethodTypes['repos']['listBranches']['response']['data']>;
|
|
66
|
+
getDefaultBranch: (options: {
|
|
67
|
+
hostname?: string;
|
|
68
|
+
owner: string;
|
|
69
|
+
repo: string;
|
|
70
|
+
}) => Promise<RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']>;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A client for fetching information about GitHub actions.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
declare class GithubActionsClient implements GithubActionsApi {
|
|
79
|
+
private readonly configApi;
|
|
80
|
+
private readonly scmAuthApi;
|
|
81
|
+
constructor(options: {
|
|
82
|
+
configApi: ConfigApi;
|
|
83
|
+
scmAuthApi: ScmAuthApi;
|
|
84
|
+
});
|
|
85
|
+
private getOctokit;
|
|
86
|
+
reRunWorkflow(options: {
|
|
87
|
+
hostname?: string;
|
|
88
|
+
owner: string;
|
|
89
|
+
repo: string;
|
|
90
|
+
runId: number;
|
|
91
|
+
}): Promise<any>;
|
|
92
|
+
listWorkflowRuns(options: {
|
|
93
|
+
hostname?: string;
|
|
94
|
+
owner: string;
|
|
95
|
+
repo: string;
|
|
96
|
+
pageSize?: number;
|
|
97
|
+
page?: number;
|
|
98
|
+
branch?: string;
|
|
99
|
+
}): Promise<RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']>;
|
|
100
|
+
getWorkflow(options: {
|
|
101
|
+
hostname?: string;
|
|
102
|
+
owner: string;
|
|
103
|
+
repo: string;
|
|
104
|
+
id: number;
|
|
105
|
+
}): Promise<RestEndpointMethodTypes['actions']['getWorkflow']['response']['data']>;
|
|
106
|
+
getWorkflowRun(options: {
|
|
107
|
+
hostname?: string;
|
|
108
|
+
owner: string;
|
|
109
|
+
repo: string;
|
|
110
|
+
id: number;
|
|
111
|
+
}): Promise<RestEndpointMethodTypes['actions']['getWorkflowRun']['response']['data']>;
|
|
112
|
+
listJobsForWorkflowRun(options: {
|
|
113
|
+
hostname?: string;
|
|
114
|
+
owner: string;
|
|
115
|
+
repo: string;
|
|
116
|
+
id: number;
|
|
117
|
+
pageSize?: number;
|
|
118
|
+
page?: number;
|
|
119
|
+
}): Promise<RestEndpointMethodTypes['actions']['listJobsForWorkflowRun']['response']['data']>;
|
|
120
|
+
downloadJobLogsForWorkflowRun(options: {
|
|
121
|
+
hostname?: string;
|
|
122
|
+
owner: string;
|
|
123
|
+
repo: string;
|
|
124
|
+
runId: number;
|
|
125
|
+
}): Promise<RestEndpointMethodTypes['actions']['downloadJobLogsForWorkflowRun']['response']['data']>;
|
|
126
|
+
listBranches(options: {
|
|
127
|
+
hostname?: string;
|
|
128
|
+
owner: string;
|
|
129
|
+
repo: string;
|
|
130
|
+
page?: number;
|
|
131
|
+
}): Promise<RestEndpointMethodTypes['repos']['listBranches']['response']['data']>;
|
|
132
|
+
getDefaultBranch(options: {
|
|
133
|
+
hostname?: string;
|
|
134
|
+
owner: string;
|
|
135
|
+
repo: string;
|
|
136
|
+
}): Promise<RestEndpointMethodTypes['repos']['get']['response']['data']['default_branch']>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** @public */
|
|
140
|
+
type Step = {
|
|
141
|
+
name: string;
|
|
142
|
+
status: string;
|
|
143
|
+
conclusion?: string;
|
|
144
|
+
number: number;
|
|
145
|
+
started_at?: string;
|
|
146
|
+
completed_at?: string;
|
|
147
|
+
};
|
|
148
|
+
/** @public */
|
|
149
|
+
type Job = {
|
|
150
|
+
html_url?: string;
|
|
151
|
+
status: string;
|
|
152
|
+
conclusion?: string;
|
|
153
|
+
started_at: string;
|
|
154
|
+
completed_at?: string;
|
|
155
|
+
id: number;
|
|
156
|
+
name: string;
|
|
157
|
+
steps?: Step[];
|
|
158
|
+
};
|
|
159
|
+
/** @public */
|
|
160
|
+
type Jobs = {
|
|
161
|
+
total_count: number;
|
|
162
|
+
jobs: Job[];
|
|
163
|
+
};
|
|
164
|
+
/** @public */
|
|
165
|
+
declare enum BuildStatus {
|
|
166
|
+
'success' = 0,
|
|
167
|
+
'failure' = 1,
|
|
168
|
+
'pending' = 2,
|
|
169
|
+
'running' = 3
|
|
170
|
+
}
|
|
171
|
+
/** @public */
|
|
172
|
+
type Branch = {
|
|
173
|
+
name: string;
|
|
174
|
+
};
|
|
175
|
+
/** @public */
|
|
176
|
+
type Branches = {
|
|
177
|
+
default_branch: string;
|
|
178
|
+
branches: Branch[];
|
|
179
|
+
};
|
|
180
|
+
/** @public */
|
|
181
|
+
interface RouterProps {
|
|
182
|
+
view?: 'cards' | 'table';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** @public */
|
|
186
|
+
declare const githubActionsPlugin: _backstage_core_plugin_api.BackstagePlugin<{
|
|
187
|
+
entityContent: _backstage_core_plugin_api.RouteRef<undefined>;
|
|
188
|
+
}, {}, {}>;
|
|
189
|
+
/** @public */
|
|
190
|
+
declare const EntityGithubActionsContent: (props: RouterProps) => react.JSX.Element;
|
|
191
|
+
/** @public */
|
|
192
|
+
declare const EntityLatestGithubActionRunCard: (props: {
|
|
193
|
+
branch: string;
|
|
194
|
+
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
195
|
+
}) => react.JSX.Element;
|
|
196
|
+
/** @public */
|
|
197
|
+
declare const EntityLatestGithubActionsForBranchCard: (props: {
|
|
198
|
+
branch: string;
|
|
199
|
+
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
200
|
+
}) => react.JSX.Element;
|
|
201
|
+
/** @public */
|
|
202
|
+
declare const EntityRecentGithubActionsRunsCard: (props: {
|
|
203
|
+
branch?: string | undefined;
|
|
204
|
+
dense?: boolean | undefined;
|
|
205
|
+
limit?: number | undefined;
|
|
206
|
+
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
207
|
+
}) => react.JSX.Element;
|
|
208
|
+
|
|
209
|
+
/** @public */
|
|
210
|
+
declare const isGithubActionsAvailable: (entity: Entity) => boolean;
|
|
211
|
+
/** @public */
|
|
212
|
+
declare const Router: (props: RouterProps) => react__default.JSX.Element;
|
|
213
|
+
|
|
214
|
+
/** @public */
|
|
215
|
+
declare const LatestWorkflowRunCard: (props: {
|
|
216
|
+
branch: string;
|
|
217
|
+
variant?: InfoCardVariants;
|
|
218
|
+
}) => react__default.JSX.Element;
|
|
219
|
+
/** @public */
|
|
220
|
+
declare const LatestWorkflowsForBranchCard: (props: {
|
|
221
|
+
branch: string;
|
|
222
|
+
variant?: InfoCardVariants;
|
|
223
|
+
}) => react__default.JSX.Element;
|
|
224
|
+
|
|
225
|
+
/** @public */
|
|
226
|
+
declare const RecentWorkflowRunsCard: (props: {
|
|
227
|
+
branch?: string;
|
|
228
|
+
dense?: boolean;
|
|
229
|
+
limit?: number;
|
|
230
|
+
variant?: InfoCardVariants;
|
|
231
|
+
}) => react__default.JSX.Element;
|
|
232
|
+
|
|
233
|
+
/** @public */
|
|
234
|
+
declare const GITHUB_ACTIONS_ANNOTATION = "github.com/project-slug";
|
|
235
|
+
|
|
236
|
+
export { type Branch, type Branches, BuildStatus, EntityGithubActionsContent, EntityLatestGithubActionRunCard, EntityLatestGithubActionsForBranchCard, EntityRecentGithubActionsRunsCard, GITHUB_ACTIONS_ANNOTATION, type GithubActionsApi, GithubActionsClient, type Job, type Jobs, LatestWorkflowRunCard, LatestWorkflowsForBranchCard, RecentWorkflowRunsCard, Router, type RouterProps, type Step, githubActionsApiRef, githubActionsPlugin, isGithubActionsAvailable, isGithubActionsAvailable as isPluginApplicableToEntity, githubActionsPlugin as plugin };
|