Scope / Motivation / Disclaimer / Tech / Features / Code example / How to use / Future development / Credits
^Scope
This project aims to create a script which will automatically push commits to my GitHub account while the program is running.
^Motivation
The motivation for this project came from an offhand jokey comment that was made during a conversation about the process of looking for a job after graduating from a coding bootcamp.
Hiring managers are apparently keen to see applicants who have been continuing to code on a regular basis, a situation which can be replicated by writing some code that does this for you.
I took this in the humour that it was intended but also saw it as a learning opportunity; I'd never before made a program which interacted with the command line or any external web based service so I decided to pursue that and see if I could learn how this was done.
^Disclaimer
This program does push commits to my GitHub profile, but has not been used to artificially boost my contributions except for a single weekend where I allowed it to run uninterupted immediately after I had completed writing the first iteration.
^Tech used
The project is written in Python 3
In the current state the whole project is using the Python standard library with no additional packages.
^Features
The project currently has the following features:
- Opened and run through the command line
- Adds a new line of text consisting of a date-time stamp into a
.txtfile - Saves,
adds,commits andpushes the new update to GitHub - Repeatedly adds, pushes etc. at random intervals of between 30 and 60 minutes
- Continues running unsupervised until the user stops the program
^Code example
Some of the lines of code as used in the program:
import os
import datetime
os.system("echo '%s' >> time_date_log.txt" % timestamp)^How to use
Users who would like to use this code should do the following:
- Clone this repository to their own machine
- Ensure that they have their GitHub account set up with an SSH key
- Open the command line and navigate to the local version of the repo
- Enter the following command:
python3 commit_bot.py - Use
Ctrl & Cto exit
^Future development
Ideas for additional functionality that might be able to be implemented include:
- A time limiter that allows the program to run for a finite amount of time
- Options to input the user's choice of random interval (min and/or max)
- Option to input the user's choice of finite running duration
And something that may require a fundamental change to the code:
- Find some way that the code (or similar code) can be run in a more automated way; without the user needing to run and/or stop the program each time.
^Credits
The original idea comes from a fellow Makers alum who should remain nameless as I do not have permission to include their name here. Additional thanks to the numerous bloggers and stackoverflow users without whom finding the relevant syntax would have been much more difficult.