Skip to content

AlesPozar/Auto-Commit-To-GitHub-Program-Shrek-Version

Repository files navigation

Auto-Commit-To-GitHub-Program-Shrek-Version

NOTE: THIS IS OBVIOUSLY A JOKE BUT IT WAS STILL A FUN ONE-DAY PROJECT I CAME UP WITH :NOTE

A Java-based program that auto-commits whichever script you want (character by character) to your GitHub repository at random intervals during the day, making your contribution graph look cool 😎. The published version is based on the Shrek script.

SETUP

Before starting the program make sure you do those things:
  • If you haven't already, install Gradle, and Java from their official websites to your device.

  • Create a .md file in your end GitHub repository, to which the text will be written, and initiate it by adding the following text to it:

<pre>Number of characters written: 0
Times rewritten: 0

This will be used so the program will know where to start.

Then go to this location app/src/main/java/org/example/app/. and open the GitHubCommitGenerator.java, to set up the next values at the start of the program:

//gitHub credentials and presets
String username = "your-username";//your username
String accToken = "your-accToken";//your access token
String repositoryName = "your-repositoryName";//your repository name
String filePath = "your-file.md";//file in which we write
String branch = "your-branch";//branch in which we write, prob. main
String contentToAddFilePath = "script.txt";//file with content to add, def. script.txt
String commitMessageToAdd = "Auto-commit: Updated state";//commit message
int minNumberOfCommitsPerDay = 2;
int maxNumberOfCommitsPerDay = 5;

your-username: Should be your GitHub username

your-accToken: Your GitHub API access Token. To get it, click on your GitHub profile, Settings, Developer settings, Personal access tokens, Tokens (classic), and generate a new token with repo and project permissions enabled.

your-repositoryName: Name of the repository you want to commit to.

your-file.md: Name of the .md file in that repository.

your-branch: Branc, usually main

contentToAddFilePath: By default it is script.txt, and is set to the Shrek script. This file contains the text you want to commit to the .md file. It resides in app/. folder.

commitMessageToAdd: Message that will be added whenever you commit a change.

min and max value for daily commits: minNumberOfCommitsPerDay and maxNumberOfCommitsPerDay.

HOW TO START AND END THE PROGRAM

To start the program make sure you are in the root of the folder and open it in the terminal. Then, start the program with
gradle build
gradle run
commands for Windows.

If everything goes right your program should start running and the following lines will be printed:

> Task :app:run
The new program was started
Program got the provided txt content
Connected to GitHub
GitHub content provided
The program was initiated with provided credentials and is now running
------------------

It should take a few seconds, but sometimes GitHub needs a bit more time to connect.

If you get any errors that stop the program mid-running (probably when you lose internet connection), just restart the program.

In case you get any error like this:

Month DD, YYYY 0:00:00 PM org.kohsuke.github.GitHubClient retryConnectionError

and your program is still running don't worry, this might happen from time to time when trying to update the content in the provided .md file. There is a code in place to wait for 1s before retrying the update. If this happens 5 consecutive times, the final error will be printed, and the program will get stopped.

When you want to end the program, just press Ctrl+C and type Y in the terminal, or press Ctrl+C two times.

END

I hope this will get you the GH contribution graph you always wanted 😉.

For any questions ask Chat GPT

⢀⡴⠑⡄⠀⠀⠀⠀⠀⠀⠀⣀⣀⣤⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
⠸⡇⠀⠿⡀⠀⠀⠀⣀⡴⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠑⢄⣠⠾⠁⣀⣄⡈⠙⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⢀⡀⠁⠀⠀⠈⠙⠛⠂⠈⣿⣿⣿⣿⣿⠿⡿⢿⣆⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⢀⡾⣁⣀⠀⠴⠂⠙⣗⡀⠀⢻⣿⣿⠭⢤⣴⣦⣤⣹⠀⠀⠀⢀⢴⣶⣆ 
⠀⠀⢀⣾⣿⣿⣿⣷⣮⣽⣾⣿⣥⣴⣿⣿⡿⢂⠔⢚⡿⢿⣿⣦⣴⣾⠁⠸⣼⡿ 
⠀⢀⡞⠁⠙⠻⠿⠟⠉⠀⠛⢹⣿⣿⣿⣿⣿⣌⢤⣼⣿⣾⣿⡟⠉⠀⠀⠀⠀⠀ 
⠀⣾⣷⣶⠇⠀⠀⣤⣄⣀⡀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ 
⠀⠉⠈⠉⠀⠀⢦⡈⢻⣿⣿⣿⣶⣶⣶⣶⣤⣽⡹⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⠀⠉⠲⣽⡻⢿⣿⣿⣿⣿⣿⣿⣷⣜⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣶⣮⣭⣽⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⣀⣀⣈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ 
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⠿⠿⠿⠿⠛⠉

("All Star" by Smash Mouth Playing)

About

A Java-based program that auto-commits whichever script you want (character by character) to your GitHub repository at random intervals during the day, making your contribution graph look cool 😎. The published version is based on the Shrek script.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages