Skip to content

Commit 8e5c0c1

Browse files
authored
fix the issue with card notes url parsing
1 parent 2906dd6 commit 8e5c0c1

File tree

6 files changed

+139
-13
lines changed

6 files changed

+139
-13
lines changed

dist/index.js

Lines changed: 96 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { renderProject } from './views/renderProject';
99
import { getProjectData } from './utils/getProjectData';
1010
import { env } from './utils/env';
1111
import { getConfigs, validateConfig } from './config';
12+
import { renderOverview } from './views/renderOverview';
1213

1314
import { IConfig } from './interfaces/IConfig';
1415

@@ -111,8 +112,8 @@ const processConfigRecord = async (
111112

112113
const issueContents = [
113114
header,
114-
// render projects overview
115-
// renderOverview(config, projectsWithData),
115+
// render all projects overview
116+
renderOverview(config, projectsWithData),
116117
issueBody,
117118
footer,
118119
].join('\n');

src/octokit/ProjectsOctoKit.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,13 @@ export class ProjectsOctoKit extends OctoKitBase {
291291
};
292292

293293
public updateBoardIssue = async (issueUrl: string, body: string) => {
294-
const { owner, repo, issueNumber } = parseIssueUrl(issueUrl);
294+
const issue = parseIssueUrl(issueUrl);
295+
296+
if (!issue) {
297+
throw new Error(`cannot parse the issue ${issueUrl}`);
298+
}
299+
300+
const { owner, repo, issueNumber } = issue;
295301

296302
return await this.kit.issues.update({
297303
owner,
@@ -302,7 +308,13 @@ export class ProjectsOctoKit extends OctoKitBase {
302308
};
303309

304310
public getBoardIssue = async (issueUrl: string) => {
305-
const { owner, repo, issueNumber } = parseIssueUrl(issueUrl);
311+
const issue = parseIssueUrl(issueUrl);
312+
313+
if (!issue) {
314+
throw new Error(`cannot parse the issue ${issueUrl}`);
315+
}
316+
317+
const { owner, repo, issueNumber } = issue;
306318

307319
const { status, data } = await this.kit.issues.get({
308320
owner,

src/utils/parseIssueUrl.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { IParsedIssue } from '../interfaces/IParsedIssue';
22

3-
export const parseIssueUrl = (issueUrl: string): IParsedIssue => {
3+
export const parseIssueUrl = (issueUrl: string): IParsedIssue | null => {
44
const uri = new URL(issueUrl);
55
const { pathname } = uri;
66

7+
if (uri.hostname !== 'github.com') {
8+
return null;
9+
}
10+
711
const split = pathname.split('/');
812

913
return {

testConfig2.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
"sprintNumberHolidays": 0,
66
"sprintStartDate": "2020-10-19",
77
"boardIssue": "https://github.com/legomushroom/codespaces-board-action-runner/issues/1",
8-
"repos": [
9-
{
8+
"repos": [{
109
"owner": "microsoft",
1110
"repo": "vssaas-planning",
1211
"projects": [
1312
{
1413
"id": 6,
14+
"priorityLabels": ["p0", "p1"],
1515
"trackLabels": [
1616
"port-forwarding",
1717
"workbench",
1818
"serverless",
1919
"performance"
2020
],
21-
"priorityLabels": ["p0", "p1"],
2221
"developers": [
2322
"legomushroom",
2423
"plisy",
@@ -28,6 +27,24 @@
2827
"klvnraju"
2928
],
3029
"isCheckListItems": true
30+
},
31+
{
32+
"id": 3,
33+
"priorityLabels": ["p0", "p1"],
34+
"developers": [
35+
"rajkumar42",
36+
"eljog",
37+
"khkh-ms",
38+
"bratsche",
39+
"edgonmsft",
40+
"dmgardiner25",
41+
"anpaskin",
42+
"kumarz",
43+
"fara-nak",
44+
"osortega",
45+
"jkeech"
46+
],
47+
"isCheckListItems": true
3148
}
3249
]
3350
}

0 commit comments

Comments
 (0)