@@ -18,11 +18,46 @@ const parseInputs = () => {
1818 return {
1919 rootIssue,
2020 accessToken: "",
21+ sectionTitle: "Spec graph",
2122 };
2223};
2324exports.parseInputs = parseInputs;
2425
2526
27+ /***/ }),
28+
29+ /***/ 1886:
30+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
31+
32+ "use strict";
33+
34+ Object.defineProperty(exports, "__esModule", ({ value: true }));
35+ exports.GitHubApiClient = void 0;
36+ const github_1 = __nccwpck_require__(5438);
37+ class GitHubApiClient {
38+ constructor(accessToken) {
39+ this.client = (0, github_1.getOctokit)(accessToken);
40+ }
41+ async getIssue(issueRef) {
42+ const response = await this.client.rest.issues.get({
43+ owner: issueRef.repoOwner,
44+ repo: issueRef.repoName,
45+ issue_number: issueRef.issueNumber,
46+ });
47+ return response.data;
48+ }
49+ async updateIssueContent(issueRef, body) {
50+ await this.client.rest.issues.update({
51+ owner: issueRef.repoOwner,
52+ repo: issueRef.repoName,
53+ issue_number: issueRef.issueNumber,
54+ body: body,
55+ });
56+ }
57+ }
58+ exports.GitHubApiClient = GitHubApiClient;
59+
60+
2661/***/ }),
2762
2863/***/ 3289:
@@ -32,7 +67,7 @@ exports.parseInputs = parseInputs;
3267
3368Object.defineProperty(exports, "__esModule", ({ value: true }));
3469exports.GraphBuilder = void 0;
35- const mermaid_node_1 = __nccwpck_require__(7537 );
70+ const mermaid_node_1 = __nccwpck_require__(235 );
3671class GraphBuilder {
3772 constructor() {
3873 this.nodes = new Map();
@@ -92,28 +127,8 @@ exports.GraphBuilder = GraphBuilder;
92127
93128Object.defineProperty(exports, "__esModule", ({ value: true }));
94129exports.IssueContentParser = void 0;
95- const github_1 = __nccwpck_require__(5438);
96130const utils_1 = __nccwpck_require__(918);
97131class IssueContentParser {
98- constructor(accessToken) {
99- this.client = (0, github_1.getOctokit)(accessToken);
100- }
101- async getIssue(issueRef) {
102- const response = await this.client.rest.issues.get({
103- owner: issueRef.repoOwner,
104- repo: issueRef.repoName,
105- issue_number: issueRef.issueNumber,
106- });
107- return response.data;
108- }
109- async updateIssueContent(issueRef, body) {
110- await this.client.rest.issues.update({
111- owner: issueRef.repoOwner,
112- repo: issueRef.repoName,
113- issue_number: issueRef.issueNumber,
114- body: body,
115- });
116- }
117132 extractIssueTasklist(issue) {
118133 var _a;
119134 const issueContent = (_a = issue.body) !== null && _a !== void 0 ? _a : "";
@@ -195,20 +210,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
195210Object.defineProperty(exports, "__esModule", ({ value: true }));
196211const core = __importStar(__nccwpck_require__(2186));
197212const config_1 = __nccwpck_require__(88);
213+ const github_api_client_1 = __nccwpck_require__(1886);
198214const graph_builder_1 = __nccwpck_require__(3289);
199215const issue_content_parser_1 = __nccwpck_require__(8352);
200- const mermaid_node_1 = __nccwpck_require__(7537 );
216+ const mermaid_node_1 = __nccwpck_require__(235 );
201217const mermaid_render_1 = __nccwpck_require__(6288);
202218const run = async () => {
203219 try {
204220 const config = (0, config_1.parseInputs)();
205- const issueContentParser = new issue_content_parser_1.IssueContentParser(config.accessToken);
221+ const githubApiClient = new github_api_client_1.GitHubApiClient(config.accessToken);
222+ const issueContentParser = new issue_content_parser_1.IssueContentParser();
206223 const mermaidRender = new mermaid_render_1.MermaidRender();
207- const rootIssue = await issueContentParser .getIssue(config.rootIssue);
224+ const rootIssue = await githubApiClient .getIssue(config.rootIssue);
208225 const rootIssueTasklist = issueContentParser.extractIssueTasklist(rootIssue);
209226 const graphBuilder = new graph_builder_1.GraphBuilder();
210227 for (const issueRef of rootIssueTasklist) {
211- const issue = await issueContentParser .getIssue(issueRef);
228+ const issue = await githubApiClient .getIssue(issueRef);
212229 const issueDetails = mermaid_node_1.MermaidNode.fromGitHubIssue(issue);
213230 graphBuilder.addIssue(issueRef, issueDetails);
214231 const issueDependencies = issueContentParser.extractIssueDependencies(issue);
@@ -217,10 +234,13 @@ const run = async () => {
217234 const graph = graphBuilder.getGraph();
218235 const renderedContent = mermaidRender.render(graph);
219236 console.log(renderedContent);
237+ const updatedIssueContent = issueContentParser.replaceIssueContent(rootIssue, config.sectionTitle, renderedContent);
238+ await githubApiClient.updateIssueContent(config.rootIssue, updatedIssueContent);
220239 }
221240 catch (error) {
222241 if (error instanceof Error) {
223242 core.setFailed(error.message);
243+ throw error;
224244 }
225245 }
226246};
@@ -229,7 +249,7 @@ run();
229249
230250/***/ }),
231251
232- /***/ 7537 :
252+ /***/ 235 :
233253/***/ ((__unused_webpack_module, exports) => {
234254
235255"use strict";
@@ -256,10 +276,10 @@ class MermaidNode {
256276 return "notstarted";
257277 }
258278 static getStartNode() {
259- return new MermaidNode(' start', ' Start' , "notstarted");
279+ return new MermaidNode(" start", " Start" , "notstarted");
260280 }
261281 static getFinishNode() {
262- return new MermaidNode(' finish', ' Finish' , "notstarted");
282+ return new MermaidNode(" finish", " Finish" , "notstarted");
263283 }
264284}
265285exports.MermaidNode = MermaidNode;
@@ -8074,7 +8094,7 @@ conversions["RegExp"] = function (V, opts) {
80748094
80758095/***/ }),
80768096
8077- /***/ 1654 :
8097+ /***/ 7537 :
80788098/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
80798099
80808100"use strict";
@@ -8290,7 +8310,7 @@ exports.implementation = class URLImpl {
82908310
82918311const conversions = __nccwpck_require__(4886);
82928312const utils = __nccwpck_require__(3185);
8293- const Impl = __nccwpck_require__(1654 );
8313+ const Impl = __nccwpck_require__(7537 );
82948314
82958315const impl = utils.implSymbol;
82968316
0 commit comments