Skip to content

Commit 7cd012b

Browse files
committed
feat: include every reaction in the vote log
For completeness the log lists everyone who reacted, not just the steering committee, so the comment is a full record of the thumbs up and down. The vote-end count is unchanged.
1 parent 2f4f886 commit 7cd012b

2 files changed

Lines changed: 5 additions & 27 deletions

File tree

dist/index.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9618,15 +9618,7 @@ function buildUpdatedComment(body, newLines, newState) {
96189618
return `${withoutMarker}\n${newLines.join('\n')}\n\n${stateMarker}`;
96199619
}
96209620
exports.buildUpdatedComment = buildUpdatedComment;
9621-
function steeringCommitteeMembers() {
9622-
return __awaiter(this, void 0, void 0, function* () {
9623-
return (yield octokit_1.default.teams.listMembersInOrg({
9624-
org: 'publiccodeyml',
9625-
team_slug: 'steering-committee',
9626-
})).data.map(m => m.login);
9627-
});
9628-
}
9629-
function syncIssueVoteLog(owner, repo, issueNumber, members) {
9621+
function syncIssueVoteLog(owner, repo, issueNumber) {
96309622
var _a;
96319623
return __awaiter(this, void 0, void 0, function* () {
96329624
const comments = yield octokit_1.default.paginate('GET /repos/:owner/:repo/issues/:issue_number/comments', { owner, repo, issue_number: issueNumber });
@@ -9643,9 +9635,8 @@ function syncIssueVoteLog(owner, repo, issueNumber, members) {
96439635
repo,
96449636
comment_id: voteComment.id,
96459637
});
9646-
const committee = members !== null && members !== void 0 ? members : yield steeringCommitteeMembers();
96479638
const liveReactions = reactions.data
9648-
.filter(r => { var _a, _b; return (r.content === '+1' || r.content === '-1') && committee.includes((_b = (_a = r.user) === null || _a === void 0 ? void 0 : _a.login) !== null && _b !== void 0 ? _b : ''); })
9639+
.filter(r => r.content === '+1' || r.content === '-1')
96499640
.map(r => ({
96509641
login: r.user.login,
96519642
content: r.content,
@@ -9673,8 +9664,7 @@ function run(owner, repo) {
96739664
const issues = yield octokit_1.default.paginate('GET /repos/:owner/:repo/issues', {
96749665
owner, repo, state: 'open', labels: 'vote-start',
96759666
});
9676-
const members = yield steeringCommitteeMembers();
9677-
yield Promise.all(issues.map(issue => syncIssueVoteLog(owner, repo, issue.number, members)));
9667+
yield Promise.all(issues.map(issue => syncIssueVoteLog(owner, repo, issue.number)));
96789668
});
96799669
}
96809670
exports["default"] = run;

src/commands/voteSync.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,10 @@ export function buildUpdatedComment(
9191
return `${withoutMarker}\n${newLines.join('\n')}\n\n${stateMarker}`;
9292
}
9393

94-
async function steeringCommitteeMembers(): Promise<string[]> {
95-
return (await octokit.teams.listMembersInOrg({
96-
org: 'publiccodeyml',
97-
team_slug: 'steering-committee',
98-
})).data.map(m => m.login);
99-
}
100-
10194
export async function syncIssueVoteLog(
10295
owner: string,
10396
repo: string,
10497
issueNumber: number,
105-
members?: string[],
10698
): Promise<void> {
10799
const comments = await octokit.paginate(
108100
'GET /repos/:owner/:repo/issues/:issue_number/comments',
@@ -125,10 +117,8 @@ export async function syncIssueVoteLog(
125117
comment_id: voteComment.id,
126118
});
127119

128-
const committee = members ?? await steeringCommitteeMembers();
129-
130120
const liveReactions: LiveReaction[] = reactions.data
131-
.filter(r => (r.content === '+1' || r.content === '-1') && committee.includes(r.user?.login ?? ''))
121+
.filter(r => r.content === '+1' || r.content === '-1')
132122
.map(r => ({
133123
login: r.user!.login,
134124
content: r.content as '+1' | '-1',
@@ -163,7 +153,5 @@ export default async function run(owner: string, repo: string): Promise<void> {
163153
},
164154
) as Array<{ number: number }>;
165155

166-
const members = await steeringCommitteeMembers();
167-
168-
await Promise.all(issues.map(issue => syncIssueVoteLog(owner, repo, issue.number, members)));
156+
await Promise.all(issues.map(issue => syncIssueVoteLog(owner, repo, issue.number)));
169157
}

0 commit comments

Comments
 (0)