How to make a code contribution to Rasa
Contributing to open source projects is one of the best ways to improve your development skills, build up your experience in software development or event build your personal brand. However, at the beginning, contributing to open source may look like a daunting process and you may ask yourself questions like: ‘What contributions I can make?’, ‘Where do I even get started?’, ‘How the process of contributing to open source even looks like?’.
We want to make it as easy as possible for you to contribute so we are sharing some tips on how to do it and how the whole process looks like.
Choosing a contribution
There are a few different things that fall under the category of code contributions. You can choose an existing issue or bug and work on resolving it, you can report a new issue and work on it, or you can propose a completely new feature.
- Working on an existing issue. If you choose to work on an existing issue, check out the Rasa contributors board to find existing open issues you can work on. The issues are handpicked by the Rasa team to have labels which correspond to the difficulty/estimated time needed to resolve the issue. Once you find an issue you would like to work on, add a comment stating that you would like to work on it. Someone from Rasa will assign that issue to you and help you along the way.
- Working on a new feature. If you would like to add a new feature or fix an unreported bug, make sure to first one an issue on Rasa repository stating what you would like to implement. Rasa team will get in touch with you to discuss if the proposed feature aligns with company’s roadmap and will guide you along the way in shaping the proposed feature so that it could be merged to the Rasa codebase.
Creating a contribution
Once you decide on what to contribute, it’s time to actually implement it. All code contributions will have to be created as pulls requests (PR’s) on GitHub. If you are new in creating pull requests, check out the guide below.
1. Fork the Rasa repository
Head to Rasa repository and click ‘Fork’. Forking a repository creates you a copy of the project which you can edit and use to propose changes/improvements to the original project.
Once you fork, a copied Rasa repository will appear inside your GitHub repository list.
2. Clone the forked repository locally
To make changes to your copy of the Rasa repo, clone the repository on your local machine. To do that, run the following command in your terminal:
The link to the repository can be found after clicking Clone or download button as shown in the image below:
Note: this assumes you have git installed on your local machine. If not, check out the following guide, to learn how to do that.
3. Update your forked repository
Before you make any changes to your cloned repository, make sure you have the latest version of the original Rasa repository. To do that, run the following commands in your terminal:
cd rasa git remote add upstream git://github.com/RasaHQ/rasa.git git pull upstream master
This will update the local copy of the Rasa repository to the latest version.
4. Implement your contribution
At this point, you are good to make changes to the files in the local directory of your project. If you want, you can create a new branch which will contain the implementation of your contribution. To do that, run:
git checkout -b name-of-your-new-branch
5. Push changes to your forked repository on GitHub
Once you are happy with the changes you made in the local files, push them to the forked repository on GitHub. To do that, run the following commands:
git add . git commit -m ‘fixed a bug’ git push origin name-of-your-new-branch
This will create a new branch on your forked Rasa repository and let you create a Pull Request with you proposed changes.
6. Open a Pull Request
Head to the forked repository and click on a Compare & pull request button.
This will open a window where you can choose the repository and branch you would like to propose your changes to, as well as specify the details of you contribution. In the top panel menu choose the following details:
- Base repository: RasaHQ/rasa
- Base branch: master
- Head repository: your_giithub_username/rasa
- Head branch: name-of-your-new-branch
Next, make sure to update the pull request card with as many details about your contribution as possible. Proposed changes section should contain the details of what has been fixed/implemented and Status should reflect the status your contributions. If you are ready to get the feedback on your contribution from the Rasa team, tick the made PR ready for code review box.
Once you are happy with everything, click Create pull request button.
This will create a Pull Request with your proposed changes.
7. Sign the CLA
To merge your contributions to the Rasa codebase, you will have to sign a Contributor License Agreement (CLA). It is necessary for us to know that you agree for your code to be included into the Rasa codebase and allow us to use it in our later releases. You can find a detailed Rasa Contributor Licence Agreement here.
8. Get your contribution merged to the Rasa OSS
Once you sign the CLA, a member from the Rasa team will get in touch with you with the feedback on your contribution. In some cases, contributions are accepted right away, but often, you may be asked to make some edits/improvements. Don’t worry if you are asked to change something - it’s a completely normal part of software development.
If you have been requested to make changes to your contribution, head back to the local copy of your repository on your machine, implement the changes and push them to your contribution branch by repeating instructions in the step 5. Your pull request will automatically be updated with the changes you pushed. Tag a person who first reviewed your contribution by mentioning them in the comments of your PR. Finally, if your contribution is accepted, the Rasa team member will merge it to the Rasa codebase.
Celebrate and share your accomplishment with the world!
Contributing to open source takes time and effort so you should be proud for the great work you have done! Let the world know that you have become a contributor to the Rasa open source project by posting about it on your social media (make sure to tag @RasaHQ as well), mention the contribution on your CV and get ready to get some really cool Rasa contributor swag!