bactensor / github-family-observer

A discord bot which reports work on a repository and its forks
1 stars 4 forks source link

Project Documentation

Overview

This project is designed to monitor the development progress of a repository by initializing the main repository and its family in a database, and continuously running a specified script at defined intervals. The project consists of several scripts that work together to achieve this goal.

How to Run the Package

  1. Clone the Repository:

    git clone https://github.com/bactensor/github-family-observer.git
    cd github-family-observer
  2. Install Dependencies:

    pip install -r requirements.txt
  3. Set Up the .env file:

    GIT_ACCESS_TOKEN = "your git access token here"
  4. Prepare the config file: The script uses config.yaml file to get the configuration. Each run will store the current state of the repository in a SQLite database. Path to the database is specified in the config file. You can prepare your own config file based on the example in the repository. Here is the structure of the config file:

    # config.yaml
    DATABASE_DIR: "/path/to/your/db"
    MAIN_REPO: "your main repo owner/name"
    FORKS:
      - "your fork owner/name"
      - "your another fork owner/name"
    DISCORD_WEBHOOK_URL: "your discord bot webhook url here"
  5. Run the Main Script: Run the script providing the config file and (optionally) wait interval between consecutive runs (in seconds).

    python main.py --interval 3600 config.yaml

Target

The primary target of this project is to monitor the development progress of a repository by:

Main Principles

  1. Initialization:

    • The main repository and its family are initialized in the database using the GitHub API.
    • The initial state of the repository is fetched and stored in the database.
  2. Continuous Monitoring:

    • A specified script is run continuously at defined intervals to update the repository state.
    • The state data is processed to generate reports on branches and pull requests.

Script Explanations

main.py

This script initializes the main repository and repository family in the database and continuously runs a specified script at defined intervals.

database.py

This script initializes the database with the initial state of the main repository.

Example Directory Structure

project/
    │
    ├── main.py
    │
    ├── observing/
    │   └── bot/bot.py
    │   └── observer/
    │   └── utils/database.py
    │── .env
    ├── db/
    │   └── ob_branch.db
    │   └── ob_prs.db
    │
    │   
    ├── config.yaml
    └── run.py  # Script that is run continuously by main.py

Conclusion

By following this documentation, you should be able to set up and run the project to monitor the development progress of a repository. Each script plays a crucial role in initializing the database, continuously updating the repository state, and generating reports.