Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Merged PR shoutout misses the count when the program label is added after the merge

Open
#59 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
api, backend

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

bug hacktoberfest help wanted

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 labeled event 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 labeled for 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 way closed does (lines 204 to 225).
  • Store the shoutout's message id when it's posted (sendMessage returns 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 labeled event changes nothing.

Where to look

  • src/webhook.ts: onPullRequest (line 189)
  • src/messages.ts: mergedPrMessage (line 88)
  • src/discord.ts: sendMessage (line 118) and editMessage (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 labeled event 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 typecheck and npm test pass

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from codercops/discord-bot

All issues in codercops/discord-bot

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.