Automating GitHub with (PRO)BOTS!!
As a part of Rails Girls Summer of Code Program 2018, our team $ We Init worked towards building our first Probot app titled ‘ First Timers Only App’.
The aim of this app was to develop a bot that ensures exactly one newcomer issue is assigned per person so that it’s fair for all newcomers. Additionally, it encourages the no-more-newcomers to take up challenging issues once they’re comfortable with the workflow after having tackled a newcomer issue.
Why did we choose this idea?
When we began contributing to open source, we got particularly interested in one of the projects that was focused on front-end work. But to our utter disappointment, the project had all the beginner-friendly issues claimed by the same person. This later on motivated us to finalize the idea of our first bot that we built under RGSoC.
About the Probot Framework
According to the official docs:
Probot is a framework for building GitHub Apps in Node.js. It aims to eliminate all the drudgery–like receiving and validating webhooks, and doing authentication handstands–so you can focus on the features you want to build.
Probot ensures that the developers focus on building the essential app functionality without caring about the other intricate issues.
Find some super cool Probot apps here.
How did we implement the idea?
Our bot is based upon these steps :
- Whenever a user comments on any issue, it is detected using “issue_comment” event. If the comment created is asking for claiming the issue, further actions are taken. To check if the comm-enter wanted to claim the issue, we check the comment body against a configurable list of comments. Current lists include comments like :
‘Can I work on this?’ ,‘I want to work on this’, ‘I wanna claim this!’
‘I wish to work on this’ etc.
To help us improve the performance of the bot you can suggests more such comments by commenting on issue#19
2. The next step involves checking whether the current issue is actually a first-timers issue or not. The label of the issue is returned in the payload response of the said event. We have created an array of labels( For e.g.
new-comers-issue) used for tagging new comer issues. The two are compared to give a result.
If the issue label matches any of of the array entries , then further action will be taken.
3. If a match is found, then using the user details from payload returned on the issue_comment event, we are searching all the issues of the repository, for the detected label and commenter to check if they are assigned one.
4. In case a match is found, we will create a comment to inform the user that they cannot claim more than one new-comers issue.
Our Future Goal!
By using fuzzy logic in natural language processing on some standard phrases, we aim to detect if the commenter is trying to claim the issue.
How did we do the testing ?
From the official docs:
Writing tests using the
await syntax is easy. We used “Behaviour Driven Development (BDD) style testing.”
We tested the various functionalities of our bots like ‘’isCommentAskingForClaimingTheIssue’ and ‘isAFirstTimersOnlyIssue’ .
To learn how to write tests, refer our code.
See how it works !
How to contribute?
You can open issues and send prs to our repository First-Timers-Only-App.
We would be more then happy to accept contributions 😃
or comment below!
Happy Coding! 😊