Breaking into Open-Source with ChatGPT’s Help: My First Contribution Experience

Ayush Yadav
7 min readJan 6, 2024

--

Open-source projects are a great way to get involved in the software development community, learn new technologies, and make a difference. With a wide range of open-source projects to choose from, it can be difficult to know where to start, especially if you are new to the open-source world. That’s where ChatGPT comes in to help. In this blog, I’ll share my experience of making my first open-source contribution with the help of ChatGPT.

“I’ll rather watch the video” -> youtube link

Introduction

I have always been fascinated by the open-source community, and I have tried to contribute to open-source projects before but I have failed at it. I was getting FOMO (Fear of Missing Out) seeing other people contribute to open-source, and I thought to myself, “I have the skills, I can contribute.” That’s when I thought ChatGPT could help me. I watched several videos about open-source before, and I knew the basics of Git and what the usual drill was. The usual drill involves:

  1. Search for an organization
  2. Look for a good first issue
  3. Get it assigned
  4. Set up communication (Slack, Discord, email list, etc.)
  5. Set up the project locally (fork it, clone it, do all setup)
  6. Make the changes
  7. Create a branch, commit, and push it
  8. Create a pull request, get it merged.

Selecting an Organization

I started by going through the GSOC 22 organizations. I used ChatGPT to summarize the organization pages, making it easier for me to read. However, I soon realized that it would be better to first find an issue. So, I opened a few organizations that I found by looking at the products I use daily, such as P5js, Firefox, etc. I ended up on WordPress as I had tried their new tool a few days earlier.

Selecting the Issue

I went browsing through good first issues for different organizations. Instead of reading the whole chat around the issue, I copied it all and asked ChatGPT to summarize the issue-related chat and also explain what the issue was that I needed to fix. (Tip: If you cannot copy the whole chat, tell ChatGPT you will copy the chat related to the issue in parts, and when you say “finished”, it should give you a summary.) I finally found an issue to add a toast (pop-up text) message when the user tries to change the primary site but has only one.

Getting It Assigned

I asked them to assign me the issue, but I had already started working on it by that time. Later on, I got it assigned.

Setting up Communications

I joined the Slack group and downloaded the app. This may vary depending on the organization.

Setting up the Project Locally

Note: This step may vary in difficulty depending on the technology you work on or the experience you have. I have failed at this step once before in the Firefox project.

After I got the project assigned, I started with the setup process. To set up the project, I read through the Readme file and got some build instructions. However, I wasn’t sure about some of the instructions, so I passed them to ChatGPT and asked it for clarification. With the help of ChatGPT, I installed NVM and it helped me with the instructions on how to fork and clone the repo. I also asked it how to run a command that I was supposed to run, and it helped me set up environment variables when I encountered an SDK error.

According to Readme, A file name Local.properties was supposed to be auto-generated, but it didn't get generated. So I asked ChatGPT about it and it told me how to set up a new one myself. During the process of downloading NVM, I encountered an issue and I copied a command from Stack Overflow to try to fix it. Unfortunately, this command caused issues with cloning from Github. But with the help of ChatGPT, I was able to revert it and undo the mess I had made.

Infinite Loading Bug

Once I set up the project, I ran the app, but it took a lot of time and I didn’t know what was happening. I was copying the commands from the Readme file to run the build, but it never finished. I asked ChatGPT for help and it gave me several solutions, but none of them worked. I later learned that the issue was related to limited RAM.

Two days later, I got a reply from the Slack group mentioning that I should change one setting in the gradle.properties file to run it on low RAM. I asked ChatGPT to explain the settings, and tried the fix, but still, the build took 45 minutes. However, since I learned that gradle.properties can affect performance, I asked ChatGPT for the optimal settings based on my hexacore CPU and the situation of building the project. It suggested using multiple cores, and after tweaking the settings, the build finished in just 1 minute and 30 seconds.

Resolving the Issue

After encountering the issue, I reached out to ChatGPT for assistance. My goal was to add a toast message on the click of the primary site, in the Account section of the user.

Attempt 1: Providing the Project Structure

I initially thought of giving ChatGPT the directory and file structure of the project, hoping that it could tell me exactly where to make the necessary changes. However, the Android project was large and had over 33,000 files, making it challenging for ChatGPT to provide a comprehensive solution. I ultimately scrapped this approach.

Attempt 2: Providing Context

I provided ChatGPT with the details of the issue and the project structure as described in the Readme file. It suggested that I search for the string ‘primary_site’ within the code. After some browsing, I found a Data class that appeared to contain the relevant code.

I then asked ChatGPT where to add the toast message within this Data class. It identified the specific variable that needed to be checked and suggested adding the code within the Fragment or Activity of the Data class. I found the Fragment by browsing the folder structure and passed its code to ChatGPT, ChatGPT based on previous context understood where the code should be written & wrote it.

Despite some initial confusion, I was eventually able to implement the code successfully and the toast message was displayed as intended.

Clean Code Implementation

To display the message in a cleaner manner, I attempted to declare the strings in the strings.xml file. However, I encountered issues because I was making changes in the wrong strings.xml file. I later realized that large projects often have multiple strings.xml files, and after making the necessary changes, I moved on to committing the code.

Code and Contribution Guidelines

Before making any commits, I reviewed previous merged pull requests (PRs) to understand the appropriate way to name my commits and PRs.

First Pull Request Attempt

I committed, pushed the code, and created a pull request. I asked my mentor to initiate the continuous integration checks, but they failed.

Second Pull Request Attempt & Final Merge

I realized that I had forgotten to add the necessary checks and ran them locally, fixing the errors. The updated code passed all CI checks, and the pull request was finally merged into WordPress.

Conclusion:

In conclusion, I am extremely glad that I was able to use ChatGPT to make my first open-source contribution. Despite facing some challenges along the way, it was a great experience and I learned a lot about coding and project management. I encourage all new contributors to give ChatGPT a try and see how it can help bridge the gap of knowledge and help make your first open-source contribution a reality. With the help of this AI model, you can easily get step-by-step guidance and solutions to the problems you may encounter. So, don’t hesitate to give it a try and join the open-source community!

--

--

Ayush Yadav

Generative AI Wizard | Building the future one pipeline at a time.