The project came about as a desire to sync the contribution graph between my GitHub accounts. I'm required to use a different, private GitHub account for work, and I figured I should be able to show off the hard work that I carry out everyday on my public profile. Enter this tool.
This tool will scrape your public GitHub profile (so make sure those contributions are visible!) and build a Bash script to either be run within this repository or at your leisure to historically build a series of commits associated to you, so you can populate your graph in the same way.
This program was written using the amazing Laravel Zero - check laravel-zero.md
for more information.
This application is compiled into a standalone executable, but you'll still need the following to run it:
- PHP 8.1 or above
- PHP-DOM and PHP-CURL extensions
It has been tested on both Windows and the latest version of Ubuntu, but it should work on other platforms provided the above prerequisites are met.
You can download the latest release from the releases section of this repository.
You can alternatively clone this repository and run the uncompiled version of the application, or compile it yourself. You will need Composer to install the dependencies:
- Clone this repository to your computer (or use a tool of your choice):
git clone https://github.com/oliverearl/github-sync-tool.git
- Navigate into the directory and install dependencies using Composer:
cd github-sync-tool
composer install
- View the list of available commands by invoking the program:
./gh-sync
- (Optional) You can compile the program into an executable with the following:
./gh-sync app:build
The only limitation is that the application cannot natively execute the script since it's written in Bash, and this application assumes that you're unable to execute it.
The program takes two parameters:
./gh-sync oliverearl 2022
The first parameter is the GitHub account username that you want to pull contributions from. Ensure that it is visible even when logged out. Do not include the '@' symbol or the full web address or an error will be displayed.
On running the program, you will be prompted to provide a name and email address to associate with your Git commits. The program won't continue without them as it does not want to make any assumptions.
Important: Make sure you choose an email address associated with your GitHub account or this won't work!
Next, after the program has enumerated the contributions, it will ask you if its findings look correct and that you want to proceed. If so, it'll write a Bash script to the current working directory containing the username of the targeted GitHub account.
Lastly, if you're not running on Windows, it will ask you whether you want to immediately execute this script in the current directory. This assumes that the script is running in a Git repository. If you're not sure, choose no, and run the script manually in the directory of your choosing.
Once the script has run, you will find that the current Git repository has been populated with commits. You can push these to GitHub, where you'll have your contribution graph updated, though please bear in mind this can take up to 24 hours.
Upcoming features planned include:
-
Proper documentation and an updated README! That's my first priority.
-
Feature tests for the entire process, as they're still in-progress.
-
Accepting a range of dates as a parameter, or automatically looking for all dates.
-
Supporting other platforms, namely GitLab and Bitbucket but open to other suggestions.
-
Supporting exports to Batch or PowerShell as alternatives to Bash scripts.
If you have a suggestion that would make this better, please fork the repo and create a pull request.
Tests, bugfixes, and documentation are especially welcome.
New functionality must include relevant tests. You can write these in PHPUnit or Pest, but be consistent.
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.md
for more information.
-
@kefimochi for inspiring me to create this tool, as they have provided a similar solution written in Node.
-
@nunomaduro and @owenvoke for producing the amazing Laravel Zero framework, as well as Pest which is used here for testing!
-
@taylorotwell for the amazing Laravel framework.
-
@othneildrew for providing the useful README template.