Gerrit/GitHub

From mediawiki.org
(Redirected from Github)


The authoritative repository for nearly all Wikimedia projects is https://gerrit.wikimedia.org. It is where we conduct code review with Gerrit software and trigger Continuous integration tests. There is some integration with the commercial service https://github.com.

GitHub mirrors[edit]

Most Wikimedia projects are mirrored on GitHub under https://github.com/wikimedia (phab:T37429), e.g.

You can browse these projects on GitHub and even fork them.

Pull requests for mirrors[edit]

Pull requests on GitHub for projects mirrored from Gerrit will be automatically closed by a bot. In order to propose changes to a repository hosted on Gerrit, you will have to create a gerrit change for review from your pull request, or ask someone else to.

Projects on GitHub[edit]

Last updated: 2023-03-21 Active GitHub Repos: 170

Setting up the GitHub triangular workflow[edit]

This is a guide on contributing to Wikimedia's Gerrit-hosted projects with a GitHub-based workflow. This guide is aimed mainly at Windows-based users that use GitHub for Windows (GitHub Desktop), but should also be usable for contributors who work from the console. However, for this last group, contributing using Gerrit/git-review is probably easier.

In this guide, I'm using the pywikibot repository as an example, but the same workflow can be applied to any repository hosted in WMF's Gerrit. The GitHub for Windows workflow has some issues (notably GHfW reporting an error while pushing).

The normal GitHub workflow is as follows:

  1. Clone from the original repository
  2. Push to your own repository
  3. Submit a pull request

We will set up this using GitHub for Windows:

Cloning the repository[edit]

  1. Go to wikimedia/pywikibot
  2. Click 'Clone in Desktop'

GitHub desktop will now launch, and clone pywikibot, including all submodules.

Forking the repository[edit]

  1. Go to wikimedia/pywikibot
  2. Click 'Fork'

A fork is now created under your GitHub username, e.g. wikimedia/pywikibot

Setting up push options[edit]

We now want to configure git to pull from the central repository (wikimedia/pywikibot) and to push to your own repository (https://github.com/<username>/pywikibot). For this, follow these steps:

  1. In GitHub for Windows, click tools » open a shell here
  2. In this shell, type these commands:
    1. git config remote.origin.pushurl https://github.com/<username>/pywikibot.git
    2. git config remote.origin.push +refs/heads/*:refs/heads/*

The first command configures your own GitHub repository as place to push, the second sets 'force push' as default - this will result in your fork to be always equal to what you have locally in GitHub for Windows.

Submitting a patch[edit]

  1. Make some changes
  2. In GitHub for Windows, click 'master' and type a branch name in the 'Filter or create new' field. Press Enter to create it.
  3. Select files to commit and press 'commit'
  4. Press 'publish'. Your changes are now pushed to your own repository on GitHub.
  5. Browse to wikimedia/pywikibot
  6. Under 'Your recently pushed branches' click 'Compare & pull request'
  7. Add a note, then click 'Send pull request'

Updating a patch[edit]

  1. Make some changes
  2. Commit to the relevant branch
  3. Click 'sync'
  4. If you get an error message, click tools » open a shell here, and run 'git push'. This should always succeed.
  5. The change is automatically added to your pull request

Other GitHub organizations[edit]

It's a mess! Here are a few of the existing Wikimedia-focused group repositories.

See also https://github.com/MWStake/nonwmf-extensions for a super-repository of MediaWiki extensions not hosted at Wikimedia.

Plus countless personal repositories.

See Also[edit]

  • phab:T37497 - Implement a way to bring GitHub pull requests into Gerrit.
    • G2G, a set of scripts that make Gerrit / GitHub interoperability possible.
    • sync-gerrit.bash script to move GitHub pull requests to Gerrit Changeset manually (discussion).