vishesh-baghel / glide

You can see how Glidee-bot works by installing it from here
https://github.com/apps/glidee-bot
ISC License
0 stars 0 forks source link

Add database and save details for every installation #1

Closed vishesh-baghel closed 8 months ago

vishesh-baghel commented 9 months ago

Tasks:

vishesh-baghel commented 9 months ago

Models:

Installation:

The bot will follow these steps to comment on a PR:

  1. It will listen for every PR open event. This event will be the starting trigger.
  2. Now, to comment on files with associated risk scores, the bot would need the file names that are modified in the PR.
  3. The bot got the file names, and now It will fetch the file names from the DB to get the associated risk scores.
  4. The bot will construct a good-looking comment and finally will comment on the PR.

Feature: risk scores would be more refined: The bot will follow these steps after every new installation

  1. It needs to prepare all the files with associated risk scores beforehand to react to PR events.
  2. To do so, it needs to fetch all repositories on which the bot has been installed.
  3. Then, iterate on each repository and get all files.
  4. For each file, first calculate the risk score and then save it.
  5. Now, the bot can give the files with their respective scores in every PR.

how to uniquely identify an installation on receiving a PR open event?

vishesh-baghel commented 9 months ago

How to give each file risk score before the bot triggers to comment:

  1. First, the bot will fetch the issues labeled as bugs or fixes for a repository.
  2. The response payload would have the pull requests associated with the issue, so the bot will get all the PRs related to the issue by getting the PR URL.
  3. From the PR URL the bot will get the the pull number. Using this pull number, the bot will get all the affected files and the files will be scored before saving them in the DB.
    • If the bot saves a file that already exists in the DB, it will make a new entry with the same fields but a different score(if any) to keep the historical data.
      1. The bot will repeat the process from step 1 for all the repositories for every installation.