Merged PR shoutout misses the count when the program label is added after the merge
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Read src/webhook.ts at onPullRequest, then trace mergedPrMessage in src/messages.ts and sendMessage/editMessage in src/discord.ts. Start with the merged pull request tests in test/webhook.test.ts and run them to understand the current event handling. Done means late program labels refresh the board and update the shoutout, while open PRs, unrelated labels, and already-counted shoutouts remain unchanged; the issue also calls for npm run typecheck and npm test to pass.
Written by the indexing model from the issue text.
Description
When a PR is merged, the bot posts a shoutout, and when the PR counts for the program it adds "That's their Nth merged PR on the ... leaderboard." plus, once, "With N they now qualify for ..." (src/messages.ts, lines 110 and 114). onPullRequest (src/webhook.ts, line 189) only reacts to the closed event (line 191) and only looks at the labels in that event (line 200). So when hacktoberfest-accepted is added after the merge:
- the shoutout goes out without the count, and without the qualify line on a 5th PR
- the later
labeledevent is ignored, so the cached board isn't refreshed for that PR until the cache runs out (10 minutes,src/leaderboard.ts, line 60)
This isn't rare. The "Accepted label" workflow in each repo (.github/workflows/accepted-label.yml here) exists to add the label after the merge when a maintainer missed it.
What to do
- Handle
labeledfor a PR that's already merged, when the added label is a program's label and the merge falls in that program's window. Count and cache the board the waycloseddoes (lines 204 to 225). - Store the shoutout's message id when it's posted (
sendMessagereturns it; a KV key with an expiry of a few days is enough), and on the late label, edit that message so it gets the count line, and the qualify line if this is the PR that reaches the minimum. If there's no stored id, refresh the board and skip the edit. - Don't count twice: if the shoutout already has the count because the label was there at the merge, a later
labeledevent changes nothing.
Where to look
src/webhook.ts:onPullRequest(line 189)src/messages.ts:mergedPrMessage(line 88)src/discord.ts:sendMessage(line 118) andeditMessage(line 131)test/webhook.test.ts: the merged pull request tests (line 320)
Acceptance criteria
- A merged PR that gets the program label later ends up with the same shoutout text as one that had it at the merge, including the qualify line on the PR that reaches the minimum
- The board is refreshed on that event
- A
labeledevent on an open PR, for another label, or for a PR whose shoutout already has the count changes nothing - Tests for these cases
-
npm run typecheckandnpm testpass
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off develop, and open your PR against develop with Closes #59 in the description.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 14h 21m
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from codercops/discord-bot
-
bug good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
codercops/discord-bot#58 ·
Maintainers usually reply within 1 day
-
bug good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
codercops/discord-bot#57 ·
Maintainers usually reply within 1 day
-
bug good first issue hacktoberfest
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
codercops/discord-bot#56 ·
Maintainers usually reply within 1 day
-
Leaderboard page: name the people who qualify but haven't linked their GitHub yetPossibly taken @varun-pahuja claimed this 1 day ago. Openenhancement hacktoberfest help wanted
Difficulty 3/5 1-2 days Newbie friendliness 76/100
codercops/discord-bot#55 · 1 comment ·
Maintainers usually reply within 1 day
-
hacktoberfest
Difficulty 1/5 Under an hour Newbie friendliness 15/100
codercops/discord-bot#15 ·
Maintainers usually reply within 1 day
All issues in codercops/discord-bot
Similar issues
-
[BUG] rag: sentence content can cross the reported sentence boundariesPossibly taken @LJK-ikun claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
README: the Resource URI Schemas example's file://documents/* pattern only matches that literal URIOpen
Difficulty 1/5 Under an hour Newbie friendliness 88/100
platformatic/mcp#361 ·
Maintainers usually reply within 1 day
-
frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Push: sem service worker ou sem VAPID, o interruptor de Notificações fica ligado sem avisar nadaOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
melgarafael/DeskcommCRM#3164 ·
Maintainers usually reply within 1 day