How to contribute to drupal.org with Merge Requests
Now that patches are being deprecated on Drupal.org, it's time to learn how to easily contribute issues and problems to core and contributed modules via Gitlab, through Merge Requests.
In this post we will focus on explaining the currently simplest and fastest way to contribute to Drupal, using the tools and possibilities offered by the platform.
Requirements
Damn, there always have to be requirements... But don't worry, I promise they will be few:
- Have a drupal.org account - I think this is quite acceptable, right?
- Have a " confirmed " role in your drupal.org account - This role is obtained automatically 90 days after the creation of your account, although it can be obtained much sooner if you are not a suspicious user (bot, spammer, etc...) . You can get more information here. If your account does not have this role, this message will be shown in your profile:
- Get access to DrupalCode (Gitlab) - You can check this from your "My account". Your Gitlab account should be git.drupalcode.org/[alias]. If this is your first time visiting the repository, you will have to accept the terms of service.
- Get a Personal Access Token from Gitlab to work over HTTP/S - It is very simple, just go to your Gitlab profile on drupal.org and in your account settings go to "Access Tokens". Once inside, add a new Personal Token and select the scopes "write_repository" and "read_repository".
And this would be it! The way we are going to explain how to contribute in this article is through your web browser and HTTP/S, so you do not need to configure a Git client, SSH keys, GPG, or anything.
Steps to contribute to Drupal.org
There are many ways to contribute to Drupal, but in this article we are going to explain the simplest possible situation for contributing to Drupal through issues or issue queues.
For our practical case we are going to create an issue in a contributed module, in which we have observed that the Readme file is missing, which must contain a brief description, requirements, configuration and characteristics of the module.
Once created, a "Create issue fork" button will be shown at the top. We will click on said button to create a fork of the issue and a branch on which we will work.
In issues already created previously, it is possible that someone has created the fork of the issue before you, so instead of creating it you will be shown a "Get push access" button, to obtain access to the fork of the issue and create your branch of work.
Once the issue fork is created, it will show us something like this:
Now we must click on the working branch that has been created next to the fork, which in this case is called "3455971-add-readme-file", which is the ID of the issue and the title. When we click it will open Gitlab.
Now we will use the "Web IDE" tool that Gitlab provides us to be able to work with a development environment with the Visual Studio engine and from the web.
I have created a README.md file and added some documentation about the module.
The development environment has Gitlab version control integrated, so it is extremely simple and fast to version our changes directly in the branch we were working on in the issue. We add a commit message that complies with good contribution practices... And that's it!
When we commit, a window will appear in the lower right part of the Web IDE. In our case, the issue was easy to resolve and we only needed one commit to resolve the problem, so we can now create the Merge Request from the "Create MR" button.
By clicking, Gitlab will open and, after verifying that the commits and changes are correct, we can Create the Merge Request.
When doing it through the Web IDE, the title and description of the Merge Request is created automatically.
When we return to the issue, our Merge Request will appear in green and indicating that it is "mergeable". Now it is a matter of changing the status of the issue to "Needs review", so that the project maintainers are in charge of reviewing it and accepting the Merge Request so that the Readme is included in the original repository of the project.
If it were code, the issue would go through other previous states, which include code review and additional testing.
When the project maintainers review and accept the Merge Request we will be given credits for it. But... we leave this for another article. I hope it has been useful to you!