Skip to content

A simple tool to sync GitLab contributions and show them off on your GitHub profile

License

Notifications You must be signed in to change notification settings

dawidl022/gitlab-contribution-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gitlab Contribution Sync

A simple tool to sync your GitLab contribution count to your GitHub profile. Only public data on your GitLab profile is used to determine the contribution counts, so it is safe to sync private contributions.

Caveat: Due to the nature of the public GitLab API, only contributions from the last 12 months can be synchronised.

Usage

Prerequisites

  1. Create a blank private repo in your GitHub account.
  2. Ensure you have git installed locally.
  3. Ensure you are able to push to the private repo you created in step 1 (e.g. via SSH).
  4. If you wish to sync private contribution counts from your GitLab profile too, ensure you have enabled the "Include private contributions on your profile" option in your GitLab profile settings.

Installation

go install github.com/dawidl022/gitlab-contribution-sync@latest

CLI

gitlab-contribution-sync <gitlab-username> <local-target-directory> <remote-github-repo>

where:

  • <gitlab-username> is a placeholder for your GitLab username.
  • <local-target-directory> is a placeholder for a path on your local filesystem, where the tool will create and update a local repository. This directory will be created upon first usage.
  • <remote-github-repo> is a placeholder for the remote (push) address of the GitHub repo you want to sync your contributions to.

e.g.

gitlab-contribution-sync "dawidl022" "$HOME/Development/my-gitlab-contributions" "[email protected]:dawidl022/my-gitlab-contributions.git"

To re-sync your contributions, simply re-run the command with the same arguments. You can also set up a cron job to periodically run the tool.

How it works

The tool uses the same API endpoint GitLab uses to render the "calendar" on a user's profile: https://gitlab.com/users/<username>/calendar.json. For each contribution count in the calendar, a commit is created in the private GitHub repository with the correct date (but not time) of the GitLab contribution.

Future development

  • go-git could be used to move the file and git operations into memory, in order to improve performance.

  • descriptive error messages when something fails

About

A simple tool to sync GitLab contributions and show them off on your GitHub profile

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages