odin-bot-v2 icon indicating copy to clipboard operation
odin-bot-v2 copied to clipboard

Feature: Autopost certain issues to #contribution-opportunities

Open Asartea opened this issue 6 months ago • 1 comments

Complete the following REQUIRED checkboxes:

- [ ] The title of this issue follows the command name: brief description of request format, e.g. /help: add optional @user parameter

The following checkbox is OPTIONAL:

  • [x] I would like to be assigned this issue to work on it

1. Description:

Based on @01zulfi 's work in #338 as well as my own playing around (because I wanted an excuse to play with Redis), I propose a new service to post new contribution opportunities to #contribution-opportunities automatically (defining contribution opportunities as "an open issue, without assignee, which has the Status: Help Wanted label, and is within the subset of repo's targeted (see Discussion point 2).

I propose it will work as follows:

  • A new class is created in services/
  • Using cron it starts itself every time x amount of time has elapsed (see Discussion point 1)
    • (in order to start it up, a new line in ready.js could instantiate a new instance of the class and tell it to start scheduling itself)
  • For every repo checked (see Discussion point 2) it runs the following steps:
    • It queries the GitHub API for issues which match these criteria:
      • State: Open
      • Assignee: nil
      • Label: "Status: Help Wanted"
    • For each issue it performs the following steps:
      • Check if the issue is cached in Redis. If so, skip it
      • Extract the title and URL
      • Check if it's a good first issue by seeing if "Type: Good First Issue" is in the labels
      • Use this information to generate a new message
      • Put the message in an array of messages to send
    • Then, for every message in the array:
      • Send it to #contribution-opportunities
      • Cache the issue for 10 days in Redis
  • (Optional) A new slash command is added to force an immediate refresh (this might be useful for use cases like a bunch of chores/epics drop, but this is largely dependent on how long the interval between runs is)

Discussion points

  1. How long should the interval between each run be? #338 had it at once a week, but I think that's too long. For some personal testing, I had it at every 12h[1], but that might be too often. On the other hand, the fallback for "no issues are available" would be to do nothing, so the impact is relatively low.
  2. Which repo(s) should be checked? TheOdinProject/curriculum is the only repo where issues will generally be doable by every learner, but this repo and TheOdinProject/theodinproject also regularly generate help wanted issues, and those might be more interesting for NodeJS/Rails people respectively

[1] I'd ideally like the interval to be something that isn't whole days, to avoid it always posting at midnight for some people

2. Acceptance Criteria:

  • [ ] All discussion points + any other feedback is resolved
  • [ ] Based on that, the functionality above is implemented, with any necessary changes

Asartea avatar Aug 23 '24 13:08 Asartea