Want to showcase your GitLab contributions on GitHub? 👀
This tool is a fun experiment that enables you to reflect your contribution history based on public GitLab data. While GitLab might have an API offering similar functionalities, this project utilizes web scraping and data parsing techniques as a alternative approach. It's designed to mirror these contributions to another VCS platform through a three-stage process:
Task | Script |
---|---|
Extracts GitLab data and create HTML file | contributions_page_scraper.py |
Create a patch file based on the HTML data | data_parser.py |
Generate commits using metadata from the patch file. | contributions_register.py |
These scripts scrape user contribution information from the https://gitlab.com/users/user_name/activity
and generate commit messages with corresponding contributions and timestamps.
- Allows selection of a GitLab username to download data from.
- Provides progress updates during the execution.
- Generates an HTML file locally containing GitLab user's contribution data.
- Parses the data and creates a
.patch
file (gitlab_contributions.patch
). - Uses the created
.patch
file to generate commits. - Aims to ensure that GitLab contributions are mirrored on the target platform's contribution chart.
Python (3.x or above). Download Python.
-
Selenium: Used for web scraping.
pip install selenium
-
BeautifulSoup4: For HTML content parsing.
pip install beautifulsoup4
- Selenium WebDriver:
contributions_page_scraper.py
relies on this.
-
Virtual Environment: It's always a good practice to run Python scripts in a virtual environment to avoid version conflicts and keep your system Python clean. You can use tools like
virtualenv
or the built-invenv
module.Set up a virtual environment:
python -m venv myenv
Activation:
-
Windows:
.\myenv\Scripts\activate
-
macOS and Linux:
source myenv/bin/activate
Once activated, install the necessary libraries within this virtual environment.
-
- View Your Contributions: Create a new repository in your desired plataform. E.g, GitHub.
- Clone Your New Repository: After creating your repository, clone it to your local machine:
git clone [URL-of-your-repository]
-
Copy the Content: Copy the content of this project into the root folder of your cloned repository.
-
Run the Importer:
The main.py
script acts as a driver, calling the other scripts in sequence. This streamlines the process, allowing users to run a single command for the desired result:
- First,
contributions_page_scraper.py
scrapes GitLab data, producing an HTML file. - Next,
data_parser.py
scans the data from the HTML and generate a patch file. - Finally,
contributions_register.py
creates commits using the metadata from the patch file.
To execute:
python main.py
- View Your Contributions:
Push the changes and examine your platform repository's contribution chart to see the mirrored contributions from GitLab 😎.
Before running the main.py
script, ensure your local git configuration is set correctly and that your GitHub repository has been properly initialized.