Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9384,6 +9384,7 @@ function nationalSectionApprovingMember(labels, comments) {
}
const formatPercentage = (percentage) => (percentage ? `${percentage.toFixed(1)}%` : '-');
function run(context) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
// We need ncc to detect the concatenation and include the template file
// in the build
Expand All @@ -9399,6 +9400,19 @@ function run(context) {
console.error('Can\'t find the bot comment where the voting is taking place');
return;
}
const deadlineMatch = (_a = voteComment.body) === null || _a === void 0 ? void 0 : _a.match(/<!-- ##bot-vote-deadline## (\S+) -->/);
if (deadlineMatch) {
const deadline = new Date(deadlineMatch[1]);
if (deadline > new Date()) {
yield octokit_1.default.issues.createComment({
owner,
repo,
issue_number: number,
body: `The vote is still open until ${deadline.toUTCString()}.`,
});
return;
}
}
const reactions = yield octokit_1.default.reactions.listForIssueComment({
owner,
repo,
Expand Down
15 changes: 15 additions & 0 deletions src/commands/voteEnd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ export default async function run(context: Context) {
return;
}

const deadlineMatch = voteComment.body?.match(/<!-- ##bot-vote-deadline## (\S+) -->/);
if (deadlineMatch) {
const deadline = new Date(deadlineMatch[1]!);
if (deadline > new Date()) {
await octokit.issues.createComment({
owner,
repo,
issue_number: number,
body: `The vote is still open until ${deadline.toUTCString()}.`,
});

return;
}
}

const reactions = await octokit.reactions.listForIssueComment({
owner,
repo,
Expand Down