Most Committed Repository in GitHub
Recep ΓztΓΌrk
Posted on February 8, 2022
GitHub's Commit Capacity.
Motivation
Checking some relations and capabilities between client-server model, GitHub & Git.
Goal
Making this repo most committed one
How ?
- Committing and pushing from GitHub to GitHub.
- Getting
COMMIT_COUNT
andPUSH_THRESHOLD
from .env - Running
scripts
via workflows to achive 1. step ###### With Bashgit.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
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")
}
}
}
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();
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.
π πͺ π
π©
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.