Skip to content

Commit f773ed4

Browse files
authored
feat: process issues by tag label (#301)
1 parent f92156b commit f773ed4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

VKUI/complete-publish/src/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ async function run(): Promise<void> {
1010
const workflow = new WorkflowHandler(token, releaseTag);
1111

1212
await workflow.processReleaseNotes(latest === 'true');
13+
await workflow.processIssuesByTagLabel();
1314
await workflow.processMilestone();
1415

1516
if (workflow.isProcessWithError()) {

VKUI/complete-publish/src/workflowHandler.ts

+28
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ export class WorkflowHandler {
4545
}
4646
}
4747

48+
public async processIssuesByTagLabel() {
49+
try {
50+
const issueNumbers = await this.getIssueNumbersByTagLabel();
51+
52+
await this.commentOnIssues(issueNumbers);
53+
} catch (error) {
54+
if (error instanceof Error) {
55+
core.error(error.message);
56+
}
57+
this.error = true;
58+
}
59+
}
60+
4861
public async processReleaseNotes(latest: boolean) {
4962
try {
5063
const releaseNotes = await this.findReleaseNotes();
@@ -115,6 +128,21 @@ export class WorkflowHandler {
115128
}, []);
116129
}
117130

131+
private async getIssueNumbersByTagLabel() {
132+
const issues = await this.gh.paginate(this.gh.rest.issues.listForRepo, {
133+
...github.context.repo,
134+
state: 'all',
135+
labels: this.releaseTag,
136+
});
137+
138+
return issues.reduce<number[]>((issueNumbers, issue) => {
139+
if (issue.state_reason !== IGNORED_STATE && !issue.locked) {
140+
issueNumbers.push(issue.number);
141+
}
142+
return issueNumbers;
143+
}, []);
144+
}
145+
118146
private async commentOnIssues(issueNumbers: number[]) {
119147
core.debug(`Processing the following linked issues: [${issueNumbers}]`);
120148

0 commit comments

Comments
 (0)