Skip to content

Commit a610599

Browse files
authored
add header file tempalate
1 parent 1fdd731 commit a610599

File tree

7 files changed

+47
-14
lines changed

7 files changed

+47
-14
lines changed

sprints/sprint 12/header.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## DRI Schedule
2+
| Week | Primary | Backup |
3+
| ------ | -------- | ---------|
4+
| 9/28 - 10/04 | @lorenpaulsen, @nosami | @cmbrose, @josegal |
5+
| 10/5 - 10/11 | @cmbrose, @josegal | @bjbennet, @avodovnik |
6+
| 10/12 - 10/19 | @bjbennet, @avodovnik | @rajkumar42 @drasticactions |

src/interfaces/IParsedIssue.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export interface IParsedIssue {
2+
owner: string;
3+
repo: string;
4+
issueNumber: number;
5+
}

src/main.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as core from '@actions/core'
22
import {env} from './utils/env'
33

4-
// add .env file support
4+
// add .env file support for dev purposes
55
require('dotenv').config()
66

77
import {AuthorizationError} from './errors/AuthorizationError'
@@ -46,7 +46,7 @@ const renderProject = async (
4646
)
4747
const wrappedIssues = [...wrappedProgressIssues, ...wrappedDoneIssues]
4848

49-
const projectTitle = `### ${project.name}`
49+
const projectTitle = `## ${project.name}`
5050
const inWorkIssuesString = renderIssuesBlock(
5151
`🏗️ In work (${doneIssues.length}/${
5252
progressIssues.length + doneIssues.length
@@ -93,7 +93,14 @@ async function run(): Promise<void> {
9393
})
9494
)
9595

96-
console.log(result.join('\n') + '\n');
96+
const issueBody = result.join('\n') + '\n';
97+
const { status } = await projectKit.updateBoardIssue(TEST_CONFIG.boardIssue, issueBody);
98+
99+
if (status !== 200) {
100+
throw new Error(`Failed to update the issue ${TEST_CONFIG.boardIssue}.`);
101+
}
102+
103+
console.log(`Successfully updated the board issue.`);
97104
}
98105
} catch (error) {
99106
console.error(error);

src/octokit/ProjectsOctoKit.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { TProjectColumns } from '../interfaces/TProjectColumns';
66
import { TRepoIssue } from '../interfaces/TRepoIssue';
77
import { OctoKitBase } from './OctoKitBase';
88
import { TColumnTypes } from '../interfaces/TColumnTypes';
9+
import { parseIssueUrl } from '../utils/parseIssueUrl';
910

1011
type TColumnsMap = Record<TColumnTypes, TProjectColumn>;
1112

@@ -123,4 +124,15 @@ export class ProjectsOctoKit extends OctoKitBase {
123124

124125
return cardIssues;
125126
}
127+
128+
public updateBoardIssue = async (issueUrl: string, body: string): Promise<any> => {
129+
const { owner, repo, issueNumber } = parseIssueUrl(issueUrl);
130+
131+
return await this.kit.issues.update({
132+
owner,
133+
repo,
134+
issue_number: issueNumber,
135+
body,
136+
});
137+
}
126138
}

src/utils/parseIssueUrl.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { IParsedIssue } from '../interfaces/IParsedIssue';
2+
3+
export const parseIssueUrl = (issueUrl: string): IParsedIssue => {
4+
const uri = new URL(issueUrl);
5+
const { pathname } = uri;
6+
7+
const split = pathname.split('/');
8+
9+
return {
10+
owner: split[1],
11+
repo: split[2],
12+
issueNumber: parseInt(split[4], 10),
13+
};
14+
};

src/views/renderIssuesBlock.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ const renderIssuesList = (issues: IWrappedIssue[]) => {
2121

2222
export const renderIssuesBlock = (title: string, issues: IWrappedIssue[]) => {
2323
return [
24-
'',
2524
renderTitle(title),
26-
'',
2725
renderIssuesList(issues),
2826
].join('\n');
2927
}

src/wait.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)