Most Committed Repository in GitHub

booleanrecep

Recep Γ–ztΓΌrk

Posted on February 8, 2022

Most Committed Repository in GitHub

GitHub's Commit Capacity.

Motivation

Checking some relations and capabilities between client-server model, GitHub & Git.

Goal

Making this repo most committed one

How ?

  1. Committing and pushing from GitHub to GitHub.
  2. Getting COMMIT_COUNT and PUSH_THRESHOLD from .env
  3. Running scripts via workflows to achive 1. step ###### With Bash git.sh
#!/bin/bash

source .env
git pull

for i in $( eval echo {1..$COMMIT_COUNT} )
do
  git commit --allow-empty -m 'go + git + github = πŸ’₯'

 if [[ $i%$PUSH_THRESHOLD -eq 0 ]]
  then 
    git push 
    echo 'πŸ›¬ pushed successfully'
  fi
done
Enter fullscreen mode Exit fullscreen mode
With Golang

git.go

package main

import (
    "fmt"
    "os"
    "strconv"
    "os/exec"
    "github.com/joho/godotenv"
)

func main() {
    godotenv.Load() 
    commitCount, _ := strconv.Atoi(os.Getenv("COMMIT_COUNT"))
    pushThreshold, _ := strconv.Atoi(os.Getenv("PUSH_THRESHOLD"))

    git    := "git"
    commit := "commit"
    push   := "push"
    allow_empty := "--allow-empty"
    m := "-m"
    message := "'go + git + github = πŸ’₯'"

    for i := 0; i < commitCount; i++ {

        cmdCommit := exec.Command(git, commit, allow_empty, m, message)
        stdoutCommit, errCommit := cmdCommit.Output()

        if errCommit != nil {
            fmt.Println("πŸ”₯ commit error: ", errCommit.Error())
            return
        }

        fmt.Println("πŸš€ ",string(stdoutCommit))

        if (i % pushThreshold == 0) {

            cmdPush := exec.Command(git, push)
            _, errPush := cmdPush.Output()

            if errPush != nil {
                fmt.Println("πŸ”₯ push error: ", errPush.Error())

            }

            fmt.Println("πŸ›¬ pushed successfully")
        }

    }

}
Enter fullscreen mode Exit fullscreen mode
With Node

git.js

const { exec } = require("child_process");
require('dotenv').config();
const commitCount = process.env.COMMIT_COUNT;
const pushThreshold = process.env.PUSH_THRESHOLD;

const gitPull = () => {
  return exec("git pull", (err, stdout, stderr) => {
    if (err) {
      console.log("πŸ”₯ pull error: ", err);
      return;
    }
    console.log(`πŸš€ : ${stdout}`);
  });
};

const gitCommit = () => {
  return exec(
    'git commit --allow-empty -m "go + git + github = πŸ’₯"',
    (err, stdout, stderr) => {
      if (err) {
//         console.log("πŸ”₯ commit error: ", err);
        return;
      }
      console.log(`πŸš€ : ${stdout}`);
    }
  );
};

const gitPush = () => {
  return exec("git push", (err, stdout, stderr) => {
    if (err) {
      console.log("πŸ”₯ push error: ", err);
      return;
    }

    console.log(`πŸ›¬ pushed successfully: ${stdout}`);
  });
};

const run = () => {
  gitPull();

  for (let i = 0; i < commitCount; i++) {
    gitCommit();

    if (i % pushThreshold === 0) {
      gitPush();
    }
  }
};

run();
Enter fullscreen mode Exit fullscreen mode

So far experiences

Disclamer: These observation and thoughts are not meant to be correct. They are my individual experiemnt and observations.

  • In GitHub there are a few repos that have over 1m+ commits. ( I didn't examine througoutly).
  • Golang felt faster than Bash and Node, it's like a super-jet.
  • Github actions have some restrictions and limits . Some GitHub error messages are like :
    • No space left on device.
    • You are running out of disk space.
  • Temperature of my computer (2011 model Asus brand 4 core i7 processor) suddenly rised and the fan screamed. In System Monitor, the each of 4 core were over 80%.
  • With Go every second (~1000ms) ~1000 commits can be pushed. Disclamer: For that measurement I observed commit time in GitHub. So it's not scientific :)
  • Gitpod blocked my account after running some scripts on their server. As they explained doing so degraded their platform and it looked like a DoS attack. Thanks to them again for unblocking my account. It's a nice and powerful platform.
  • GitHub is such a powerful platform. Tens of thousands of file (.txt) I have created and written with commits alongside of push and nothing broken.
  • I have learned also that git has a flag that is --allow-empty and lets you write commit without any change.
  • ..... to be continued.
πŸ’– πŸ’ͺ πŸ™… 🚩
booleanrecep
Recep Γ–ztΓΌrk

Posted on February 8, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Most Committed Repository in GitHub
github Most Committed Repository in GitHub

February 8, 2022