Skip to content

Collect data from GraphQL Github and forward to platforms

License

Notifications You must be signed in to change notification settings

maemreyo/dev-works-logger

Repository files navigation

dev-works-logger

CI Rust Build a bot to collect data from Git

What are we trying to build?

  • A Bot (not for Discord)
  • It will run every week/month
  • It will check all the repositories for the organization (with Github GraphQL) for the most amount of PR for a single contributor
  • Create an image for that person and it will post it to Twitter and Discord
  • Create a docker

.env params you must have

  • GITHUB_ORG_NAME
  • GITHUB_TOKEN
  • TWITTER_TOKEN
  • DISCORD_HOOK

Image to post

Should follow:

  • A picture of the organization owning the repo
  • A text with the name of the organization on the picture
  • A Picture of the contributor
  • A text about the contributor achievement (in the picture)
  • A text about the contributor (in the tweet)
  • As much as information as possible on the contributor
  • Awesome design gets extra points

Bonuses

  • Add more things like most amount of issues, most amount of reviews and so on.

What did I do?

Utils

  • Write docs
    • How to run?
    • How to contribute?
    • Write the Makefile?
      • Welcome new comers
      • Set Git hooks dir
      • Install cocogitto tools for standardizing commits
  • Write REQUIREMENTS
  • Change the project name
    • From git-stats-bot to dev-works-logger
  • Refactor folder structure
    • +-- main.rs
    • +-- modules
    • +---- git
    • +------ mod.rs
    • +------ models
    • +-------- mod.rs
    • +-------- module1.rs
    • +-------- module2.rs
    • +---- discord
    • +------ mod.rs
    • +------ models
    • +-------- mod.rs
    • +-------- module1.rs
    • +-------- module2.rs
    • +-- utils
    • +---- init
    • +------ mod.rs

Developments

  • Manage env variables with dotenv
  • Fetch data from GraphQL Github with gql_client
  • Research GraphQL
    • Get all recent commits of a repo
    • Get all recent active repos
  • Refactor: instead of using gql_client, I plan to change it to reqwest with json body
    • Create my own request client
  • Research about Git hooks
  • Twitter API
    • Auth
    • Create a tweet
    • Determine a template for tweet
      • Title (depends on the number of CHANGED FILE to generate)
      • Body
        • Total commits in the day, total changed files
      • Tags
      • Create a function to check the tweet's length before tweeting
    • Send an email related to the tweet's status (false/true)
  • Discord
    • Enable Github Webhook for Discord
    • Discord Bot
  • Research CI/CD on Github Action
    • Add script to check Rust before merging PRs
    • Add script to deploy Docker Image to Heroku
    • Improve Deploy script
      • Divide the whole script into pieces
      • Remove some parts being not used
    • Disable CI for now, I plan to do drive the project with another direction.
  • Cronjob
    • Cronjob
  • Docker
    • Build Docker Image
    • Research docker-compose
      • Build a docker image to develop locally
    • Improve Docker Image
      • Create a minimal docker image
      • Cron job
      • ENV variables not found
        • Find a way to get a github name, token on CI
        • Pass env variables when building docker image on CI
  • Deploy to Heroku
  • Plan to deploy to another server (Heroku is not free from 28/11)
    • Docker (Auto build: 5$ per month)
    • GCS
    • Localhost is the best choice for now, until I can find the alt.
  • Send Email SMTP
    • Investigate
  • Implement CLI to trigger some features
    • Overall configurations
      • Github
        • PAC
        • Username
      • [ ]
    • Twitter commands
      • Config Twitter credentials
      • Switch ON/OFF feature
    • Email commands
      • Config Gmail credentials
        • username, password
      • Switch ON/OFF feature
    • Discord commands
      • Config Discord credentials
      • Switch ON/OFF feature
  • Add scripts to cut down the time to deal with some dev parts
    • Docker
      • Build image
      • Run image
      • Exec image
      • Push image to Docker Hub
    • Release
      • Changelog generator
    • Development
      • Run debug
  • Actix web impl (In a long-term)
    • Restructure folder
      • Monorepo
      • docker-compose for building all services
  • Database impl (MongoDB) (In a long-term)

How to run this project?

Install

  • Run Makefile with make -f Makefile