autoforce 0.1.2 → 0.1.4
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/README.md +44 -6
- package/bin/index.js +6 -0
- package/commands/new/issue.json +40 -0
- package/commands/new/process.json +21 -0
- package/commands/subtasks/checkout-branch.json +60 -0
- package/commands/subtasks/create-pull.json +20 -0
- package/commands/subtasks/create-scratch.json +84 -0
- package/commands/subtasks/deploy-code.json +17 -0
- package/commands/subtasks/drop-scratch.json +17 -0
- package/commands/subtasks/package-code.json +3 -0
- package/commands/subtasks/publish-branch.json +20 -0
- package/commands/subtasks/update-documentation.json +8 -0
- package/commands/subtasks/validate-code.json +29 -0
- package/commands/subtasks/validate-scratch.json +14 -0
- package/commands/tasks/cancel.json +6 -0
- package/commands/tasks/deploy.json +6 -0
- package/commands/tasks/finish.json +41 -0
- package/commands/tasks/rollback.json +6 -0
- package/commands/tasks/start.json +60 -0
- package/commands/tasks/stop.json +32 -0
- package/commands/tasks/switch.json +53 -0
- package/commands/tasks/view.json +12 -0
- package/lib/auto.js +30 -15
- package/lib/helpers/class.js +2 -2
- package/lib/helpers/context.d.ts +1 -1
- package/lib/helpers/context.js +24 -28
- package/lib/helpers/github-graphql.d.ts +1 -76
- package/lib/helpers/github-graphql.js +331 -363
- package/lib/helpers/lwc.js +2 -2
- package/lib/helpers/metadata.js +2 -2
- package/lib/helpers/object.js +2 -2
- package/lib/helpers/tasks.js +10 -5
- package/lib/helpers/util.d.ts +4 -1
- package/lib/helpers/util.js +45 -2
- package/package.json +11 -5
- package/templates/dictionary/class-all.md +9 -0
- package/templates/dictionary/class-diagrama.md +13 -0
- package/templates/dictionary/class-inner.md +19 -0
- package/templates/dictionary/class-metodos.md +15 -0
- package/templates/dictionary/class-public.md +13 -0
- package/templates/dictionary/class-referencias.md +5 -0
- package/templates/dictionary/class.md +29 -0
- package/templates/dictionary/classes.md +52 -0
- package/templates/dictionary/object.md +35 -0
- package/templates/dictionary/objects.md +63 -0
- package/templates/intro.md +20 -0
- package/templates/process.md +23 -0
- package/templates/story.md +32 -0
- package/templates/usecase.md +52 -0
|
@@ -1,363 +1,331 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
id
|
|
333
|
-
}
|
|
334
|
-
fieldValueByName(name: "Status"){
|
|
335
|
-
... on ProjectV2ItemFieldSingleSelectValue {
|
|
336
|
-
name
|
|
337
|
-
id
|
|
338
|
-
field {
|
|
339
|
-
... on ProjectV2SingleSelectField {
|
|
340
|
-
id
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
linkedBranches(last:1){
|
|
348
|
-
nodes {
|
|
349
|
-
ref {
|
|
350
|
-
id
|
|
351
|
-
name
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
`;
|
|
359
|
-
const { repository } = yield this.graphqlAuth(query, Object.assign({ issueNumber }, this.repoVar));
|
|
360
|
-
return repository.issue;
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
1
|
+
// import { graphql } from "@octokit/graphql";
|
|
2
|
+
export {};
|
|
3
|
+
// export class GitHubApi implements IGitApi, IProjectApi {
|
|
4
|
+
// repoVar;
|
|
5
|
+
// projectNumber;
|
|
6
|
+
// graphqlAuth;
|
|
7
|
+
// constructor(token: string, owner: string, repo: string, projectNumber?: number) {
|
|
8
|
+
// this.repoVar = { owner, repo };
|
|
9
|
+
// this.projectNumber = projectNumber;
|
|
10
|
+
// this.graphqlAuth = graphql.defaults({
|
|
11
|
+
// headers: {
|
|
12
|
+
// authorization: `Bearer ${token}`,
|
|
13
|
+
// "X-Github-Next-Global-ID": 1
|
|
14
|
+
// },
|
|
15
|
+
// })
|
|
16
|
+
// }
|
|
17
|
+
// async getUser() {
|
|
18
|
+
// const query = `{
|
|
19
|
+
// viewer {
|
|
20
|
+
// login
|
|
21
|
+
// id
|
|
22
|
+
// }
|
|
23
|
+
// }`;
|
|
24
|
+
// const {viewer }: {viewer: { login: string, id: number}} = await this.graphqlAuth(query);
|
|
25
|
+
// return viewer;
|
|
26
|
+
// }
|
|
27
|
+
// async getRepository(label?: string) {
|
|
28
|
+
// const query = `
|
|
29
|
+
// query getRepo($owner:String!, $repo: String!, $projectNumber: Int!, ${label ? '$label: String!': ''} ) {
|
|
30
|
+
// repository(owner: $owner, name: $repo) {
|
|
31
|
+
// id
|
|
32
|
+
// ${ label ?
|
|
33
|
+
// `label(name: $label) {
|
|
34
|
+
// id
|
|
35
|
+
// }` :''
|
|
36
|
+
// }
|
|
37
|
+
// projectV2( number: $projectNumber ) {
|
|
38
|
+
// id
|
|
39
|
+
// field(name: "Status") {
|
|
40
|
+
// ... on ProjectV2SingleSelectField {
|
|
41
|
+
// id
|
|
42
|
+
// name
|
|
43
|
+
// options {
|
|
44
|
+
// name
|
|
45
|
+
// id
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
// `;
|
|
53
|
+
// const { repository }: {repository: { id: string, label?: { id: string}, projectV2: { id: string, field: { id: string, name: string, options: { name: string, id: string}[] }}}} = await this.graphqlAuth(query, { label, projectNumber: this.projectNumber,...this.repoVar});
|
|
54
|
+
// return repository;
|
|
55
|
+
// }
|
|
56
|
+
// async createPullRequest(branchName: string, title: string, body: string): Promise<boolean> {
|
|
57
|
+
// const repository = await this.getRepository();
|
|
58
|
+
// const repositoryId = repository.id;
|
|
59
|
+
// const headRefName = 'main';
|
|
60
|
+
// const baseRefName = branchName;
|
|
61
|
+
// const mutationPullRequest = `
|
|
62
|
+
// mutation createPullRequest( $baseRefName: String!, $headRefName: String!, $headRepositoryId: ID, $repositoryId: ID!, $title: String!, $body: String ) {
|
|
63
|
+
// createPullRequest(
|
|
64
|
+
// input: {
|
|
65
|
+
// repositoryId: $repositoryId,
|
|
66
|
+
// headRefName: $headRefName,
|
|
67
|
+
// headRepositoryId: $headRepositoryId,
|
|
68
|
+
// baseRefName: $baseRefName,
|
|
69
|
+
// title: $title,
|
|
70
|
+
// body: $body
|
|
71
|
+
// }
|
|
72
|
+
// ) {
|
|
73
|
+
// pullRequest {
|
|
74
|
+
// id
|
|
75
|
+
// }
|
|
76
|
+
// }
|
|
77
|
+
// }`;
|
|
78
|
+
// try {
|
|
79
|
+
// const {createPullRequest}: { createPullRequest: { pullRequest: { id: string} }} = await this.graphqlAuth(mutationPullRequest, { baseRefName, headRefName, headRepositoryId: repositoryId, repositoryId, title, body });
|
|
80
|
+
// return createPullRequest.pullRequest ? true : false;
|
|
81
|
+
// } catch (error) {
|
|
82
|
+
// console.log(error);
|
|
83
|
+
// }
|
|
84
|
+
// return false;
|
|
85
|
+
// }
|
|
86
|
+
// async getColumnValueMap(){
|
|
87
|
+
// const query = `
|
|
88
|
+
// query getFieldOptions($owner:String!, $repo: String!, $projectNumber: Int!) {
|
|
89
|
+
// repository(owner: $owner, name: $repo) {
|
|
90
|
+
// projectV2(number: $projectNumber) {
|
|
91
|
+
// field(name: "Status") {
|
|
92
|
+
// ... on ProjectV2SingleSelectField {
|
|
93
|
+
// id
|
|
94
|
+
// name
|
|
95
|
+
// options {
|
|
96
|
+
// name
|
|
97
|
+
// id
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
// }
|
|
103
|
+
// }
|
|
104
|
+
// `;
|
|
105
|
+
// const { repository }: {repository: { id: string, projectV2: { id: string, field: { id: string, name: string, options: { name: string, id: string}[] }}}} = await this.graphqlAuth(query, { projectNumber: this.projectNumber,...this.repoVar});
|
|
106
|
+
// const mapValues: Record<string, string> = {}
|
|
107
|
+
// for ( const option of repository.projectV2.field.options ) {
|
|
108
|
+
// mapValues[option.name] = option.id;
|
|
109
|
+
// }
|
|
110
|
+
// return mapValues;
|
|
111
|
+
// }
|
|
112
|
+
// async createIssue(title: string, state?: string, label?: string, milestone?: string, body?: string ) {
|
|
113
|
+
// const user = await this.getUser();
|
|
114
|
+
// const repository = await this.getRepository(label);
|
|
115
|
+
// const repositoryId = repository.id;
|
|
116
|
+
// const labelId = repository.label?.id;
|
|
117
|
+
// const projectId = repository.projectV2.id;
|
|
118
|
+
// const mutationIssue = `
|
|
119
|
+
// mutation createIssue($repositoryId: ID!, $assignId: ID!, $title: String!, $body: String, ${ labelId ? '$labelId: ID!': ''} , $milestoneId: ID ) {
|
|
120
|
+
// createIssue(
|
|
121
|
+
// input: {
|
|
122
|
+
// repositoryId: $repositoryId,
|
|
123
|
+
// assigneeIds: [$assignId],
|
|
124
|
+
// ${labelId ? 'labelIds: [$labelId],': ''}
|
|
125
|
+
// title: $title,
|
|
126
|
+
// milestoneId: $milestoneId,
|
|
127
|
+
// body: $body
|
|
128
|
+
// }
|
|
129
|
+
// ) {
|
|
130
|
+
// issue {
|
|
131
|
+
// id
|
|
132
|
+
// number
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
// }`;
|
|
136
|
+
// const { createIssue }: {createIssue: { issue: { id: string, number: number } }} = await this.graphqlAuth(mutationIssue, { labelId, body, assignId: user.id, projectId, repositoryId, title, label: label? [label]: null });
|
|
137
|
+
// const issue = createIssue.issue;
|
|
138
|
+
// if ( !state || !issue.number) {
|
|
139
|
+
// return issue.number;
|
|
140
|
+
// }
|
|
141
|
+
// const mutationItem = `
|
|
142
|
+
// mutation addProjectV2ItemById($projectId: ID!, $contentId: ID! ) {
|
|
143
|
+
// addProjectV2ItemById(
|
|
144
|
+
// input: {
|
|
145
|
+
// projectId: $projectId
|
|
146
|
+
// contentId: $contentId
|
|
147
|
+
// }
|
|
148
|
+
// ) {
|
|
149
|
+
// clientMutationId,
|
|
150
|
+
// item {
|
|
151
|
+
// id
|
|
152
|
+
// }
|
|
153
|
+
// }
|
|
154
|
+
// }`;
|
|
155
|
+
// const { addProjectV2ItemById }: {addProjectV2ItemById: { item: { id: string } }} = await this.graphqlAuth(mutationItem, { projectId, contentId: issue.id });
|
|
156
|
+
// const itemId = addProjectV2ItemById.item.id;
|
|
157
|
+
// const fieldId = repository.projectV2.field.id;
|
|
158
|
+
// const mapValues = await this.getColumnValueMap();
|
|
159
|
+
// const columnValue = mapValues[state];
|
|
160
|
+
// const mutationColumn = `
|
|
161
|
+
// mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $columnValue: String!) {
|
|
162
|
+
// updateProjectV2ItemFieldValue(
|
|
163
|
+
// input: {
|
|
164
|
+
// projectId: $projectId,
|
|
165
|
+
// itemId: $itemId,
|
|
166
|
+
// fieldId: $fieldId,
|
|
167
|
+
// value: {singleSelectOptionId: $columnValue}
|
|
168
|
+
// }
|
|
169
|
+
// ) {
|
|
170
|
+
// clientMutationId
|
|
171
|
+
// }
|
|
172
|
+
// }`;
|
|
173
|
+
// const {updateProjectV2ItemFieldValue }: {updateProjectV2ItemFieldValue: { clientMutationId: string }} = await this.graphqlAuth(mutationColumn, { projectId, itemId, fieldId, columnValue });
|
|
174
|
+
// if ( !updateProjectV2ItemFieldValue.clientMutationId ) {
|
|
175
|
+
// return 0;
|
|
176
|
+
// }
|
|
177
|
+
// return issue.number;
|
|
178
|
+
// }
|
|
179
|
+
// async moveIssue(issueNumber: number, state: string): Promise<boolean> {
|
|
180
|
+
// const issue = await this.getIssue(issueNumber);
|
|
181
|
+
// const itemId = issue.projectItems.nodes[0].id;
|
|
182
|
+
// const projectId = issue.projectItems.nodes[0].project.id;
|
|
183
|
+
// const fieldId = issue.projectItems.nodes[0].fieldValueByName.field.id;
|
|
184
|
+
// const mapValues = await this.getColumnValueMap();
|
|
185
|
+
// const columnValue = mapValues[state];
|
|
186
|
+
// const mutation = `
|
|
187
|
+
// mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $columnValue: String!) {
|
|
188
|
+
// updateProjectV2ItemFieldValue(
|
|
189
|
+
// input: {
|
|
190
|
+
// projectId: $projectId,
|
|
191
|
+
// itemId: $itemId,
|
|
192
|
+
// fieldId: $fieldId,
|
|
193
|
+
// value: {singleSelectOptionId: $columnValue}
|
|
194
|
+
// }
|
|
195
|
+
// ) {
|
|
196
|
+
// projectV2Item {
|
|
197
|
+
// id
|
|
198
|
+
// }
|
|
199
|
+
// }
|
|
200
|
+
// }`;
|
|
201
|
+
// const {updateProjectV2ItemFieldValue }: {updateProjectV2ItemFieldValue: { projectV2Item: { id: string } }} = await this.graphqlAuth(mutation, { projectId, itemId, fieldId, columnValue });
|
|
202
|
+
// return updateProjectV2ItemFieldValue?.projectV2Item ? true: false ;
|
|
203
|
+
// }
|
|
204
|
+
// async assignIssueToMe(issueNumber: number): Promise<boolean> {
|
|
205
|
+
// const user = await this.getUser();
|
|
206
|
+
// const issue = await this.getIssue(issueNumber);
|
|
207
|
+
// const mutation = `
|
|
208
|
+
// mutation assignUser( $issueId: ID!, $userId: ID!) {
|
|
209
|
+
// addAssigneesToAssignable(input: {
|
|
210
|
+
// assignableId: $issueId
|
|
211
|
+
// assigneeIds: [ $userId ]
|
|
212
|
+
// }) {
|
|
213
|
+
// assignable {
|
|
214
|
+
// assignees {
|
|
215
|
+
// totalCount
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
// }
|
|
219
|
+
// }
|
|
220
|
+
// `;
|
|
221
|
+
// const {addAssigneesToAssignable }: {addAssigneesToAssignable: { assignable: { assignees: { totalCount: number } } }} = await this.graphqlAuth(mutation, { issueId: issue.id, userId: user.id });
|
|
222
|
+
// return addAssigneesToAssignable.assignable.assignees.totalCount > 0 ;
|
|
223
|
+
// }
|
|
224
|
+
// async getCommit(commitSha: string) {
|
|
225
|
+
// const query = `
|
|
226
|
+
// query getCommit($owner:String!, $repo: String!, $commitSha: String!) {
|
|
227
|
+
// repository(owner: $owner, name: $repo) {
|
|
228
|
+
// object(expression: $commitSha) {
|
|
229
|
+
// ... on Commit {
|
|
230
|
+
// id
|
|
231
|
+
// oid
|
|
232
|
+
// }
|
|
233
|
+
// }
|
|
234
|
+
// }
|
|
235
|
+
// } `;
|
|
236
|
+
// const { repository }: {repository:{ object: { id: string; oid: string}}} = await this.graphqlAuth(query, { commitSha,...this.repoVar});
|
|
237
|
+
// return repository.object;
|
|
238
|
+
// }
|
|
239
|
+
// async assignBranchToIssue(issueNumber: number, branchName: string, commitSha: string) {
|
|
240
|
+
// const issue = await this.getIssue(issueNumber);
|
|
241
|
+
// const commit = await this.getCommit(commitSha);
|
|
242
|
+
// const mutation = `
|
|
243
|
+
// mutation createLinkedBranch( $issueId: ID!, $oid: GitObjectID!, $branchName: String!) {
|
|
244
|
+
// createLinkedBranch(input: {
|
|
245
|
+
// issueId: $issueId
|
|
246
|
+
// oid: $oid
|
|
247
|
+
// name: $branchName
|
|
248
|
+
// })
|
|
249
|
+
// {
|
|
250
|
+
// issue {
|
|
251
|
+
// id
|
|
252
|
+
// }
|
|
253
|
+
// }
|
|
254
|
+
// }`;
|
|
255
|
+
// const {createLinkedBranch }: {createLinkedBranch: { issue: { id: string } }} = await this.graphqlAuth(mutation, { issueId: issue.id, oid: commit.oid, branchName });
|
|
256
|
+
// console.log(createLinkedBranch);
|
|
257
|
+
// return createLinkedBranch?.issue?.id ? true: false ;
|
|
258
|
+
// }
|
|
259
|
+
// async getIssueState(issueNumber: number){
|
|
260
|
+
// const issue = await this.getIssue(issueNumber);
|
|
261
|
+
// return issue.projectItems?.nodes[0]?.fieldValueByName?.name;
|
|
262
|
+
// }
|
|
263
|
+
// getIssueName(title: string) {
|
|
264
|
+
// return title.toLowerCase().replaceAll(' ', '-');
|
|
265
|
+
// }
|
|
266
|
+
// async getIssueObject(issueNumber: number) {
|
|
267
|
+
// const issue = await this.getIssue(issueNumber);
|
|
268
|
+
// const issueObject: IIssueObject = { title: issue.title};
|
|
269
|
+
// issueObject.name = this.getIssueName(issue.title);
|
|
270
|
+
// if ( issue.linkedBranches.nodes.length > 0 ) {
|
|
271
|
+
// issueObject.branch = issue.linkedBranches.nodes[0].ref.name;
|
|
272
|
+
// }
|
|
273
|
+
// if ( issue.projectItems.nodes.length > 0 ) {
|
|
274
|
+
// issueObject.state = issue.projectItems.nodes[0].fieldValueByName.name;
|
|
275
|
+
// }
|
|
276
|
+
// if ( issue.labels.nodes.length > 0 ) {
|
|
277
|
+
// issueObject.labels = [];
|
|
278
|
+
// for ( const node of issue.labels.nodes ) {
|
|
279
|
+
// issueObject.labels.push(node.name);
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
|
+
// return issueObject;
|
|
283
|
+
// }
|
|
284
|
+
// async getIssue(issueNumber: number){
|
|
285
|
+
// const query = `
|
|
286
|
+
// query getIssue($owner:String!, $repo: String!, $issueNumber: Int!) {
|
|
287
|
+
// repository(owner: $owner, name: $repo) {
|
|
288
|
+
// issue(number: $issueNumber) {
|
|
289
|
+
// title
|
|
290
|
+
// id
|
|
291
|
+
// labels(first:3, orderBy: { field: CREATED_AT, direction: DESC}) {
|
|
292
|
+
// nodes {
|
|
293
|
+
// color
|
|
294
|
+
// name
|
|
295
|
+
// }
|
|
296
|
+
// }
|
|
297
|
+
// projectItems(last: 1) {
|
|
298
|
+
// nodes{
|
|
299
|
+
// id,
|
|
300
|
+
// project {
|
|
301
|
+
// id
|
|
302
|
+
// }
|
|
303
|
+
// fieldValueByName(name: "Status"){
|
|
304
|
+
// ... on ProjectV2ItemFieldSingleSelectValue {
|
|
305
|
+
// name
|
|
306
|
+
// id
|
|
307
|
+
// field {
|
|
308
|
+
// ... on ProjectV2SingleSelectField {
|
|
309
|
+
// id
|
|
310
|
+
// }
|
|
311
|
+
// }
|
|
312
|
+
// }
|
|
313
|
+
// }
|
|
314
|
+
// }
|
|
315
|
+
// }
|
|
316
|
+
// linkedBranches(last:1){
|
|
317
|
+
// nodes {
|
|
318
|
+
// ref {
|
|
319
|
+
// id
|
|
320
|
+
// name
|
|
321
|
+
// }
|
|
322
|
+
// }
|
|
323
|
+
// }
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
326
|
+
// }
|
|
327
|
+
// `;
|
|
328
|
+
// const { repository }: { repository: { issue: { id: string, title: string, labels: { nodes: { name: string, color: string}[] }, projectItems: { nodes: { id: string, project: { id: string }, fieldValueByName: { name: string, id: string, field: { id: string }} }[] }, linkedBranches: { nodes: { ref: { id: string, name: string } } [] } } } } = await this.graphqlAuth(query, { issueNumber,...this.repoVar});
|
|
329
|
+
// return repository.issue;
|
|
330
|
+
// }
|
|
331
|
+
// }
|