Skip to content

first-timers-only issue bot #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
19 of 20 tasks
gr2m opened this issue Feb 18, 2017 · 17 comments
Closed
19 of 20 tasks

first-timers-only issue bot #105

gr2m opened this issue Feb 18, 2017 · 17 comments

Comments

@gr2m
Copy link
Member

gr2m commented Feb 18, 2017

🎯⛳ The goal

We want to streamline the process to create very simple contributor-friendly issues to help onboard more people to become Open Source contributors. See issues with first-timers-only label for examples.

The goal is to make creating a first-timers-only issue as simple as making the fix ourselves.

Note that this is not a an issue releated to a single bug or feature, but a project. We will use this issue to discuss the overall idea and progress.

🐶 ❓ The Motivation

At Hoodie, we aim to become the most welcoming Open Source community possible. We joined forces with initiatives like First Timers Only and Your First PR to actively reach out to new contributors and create an environment where they feel encouraged and supported.

Creating what we call starter issues is one aspect of that. And it is one of the most successful. A subset of these starter issues are super simple fixes like typos, so they are perfect to onboard people and help them get familiar with GitHub and the pull request workflow. Because typos and similar issues are so trivial, we should basically be able to automatically generate the entire starter issue based on a diff.

💡💥 How things could work

Say I’m a Hoodie contributor and find a typo somewhere. Instead of fixing the issue directly in the master branch or creating a pull request, I create a new branch that is call something like first-timers-only-typo-in-title. GitHub will notify the "first-timers-only issue bot" about the new branch using webhooks. The boot will see that the new branch is starting with first-timers-only and will create a new issue at https://github.com/hoodiehq/camp/issues/new based on a template and assign the first-timers-only and the up-for-grabs label.

If the commit body can be used to add some context information. If left empty, the 🤔 What you will need to know section of the issue will simply say "Nothing :)". Otherwise the commit body will be used there.

👩‍🏫🙋‍♂️ What you will need to know

The bot will be an Open Source Node.js service, built with our server framework of choice hapi and deployed to now.

It will use GitHub’s API and webhooks.

📋 Step by Step

  • 🙋 Claim this issue: @agonzalez0515 & @Techforchange , supported by @gr2m

  • 👌 Accept our invitation to this repository. Once accepted, assign yourself to this repository

  • 👓 Please review our Code of Conduct
    In a nutshell: be patient and actively kind with us 😊

  • Create hoodiehq/first-timers-only-bot repository

    • create a README based on the content in this issue
  • Version 1: "copy & paste"
    On the "/" landing page, show a text input to enter a URL to a branch on GitHub. When submitted, the server will respond with a link to the changed file, line number(s) and the diff as well as the Markdown that we can directly copy & paste into https://github.com/hoodiehq/camp/issues/new

    • Create a hapijs app with a public/ folder which contents get served at "/" (see inert)

    • Create public/index.html with a form to submit the branch URL. Feel free to add CSS/JS or external libraries like jQuery.

    • Define a POST /starter-issue route which takes the URL from the submitted form and responds with JSON like {"ok":true}

    • Make the form from public/index.html send background request when submitting the form. Show the response, e.g. with an alert

    • in the POST /starter-issue handler, load the meta information about that branch using GitHub’s API (see Get branch). The response will give you the sha for the commit. You can use that to get the commit meta information (GET repo commit, see example response). The response includes a "files" array which will have one entry with all information we need

    • Instead of responding with {"ok":true}, respond with path to the changed file, the diff, commit message and commit body. Based on the new response, show a textarea with markdown that can be copy & pasted into a new issue. You can use markdown.js to also render a preview of it. The result could look something like this

      Update the file [CONTRIBUTING.md](https://github.com/hoodiehq/hoodie/blob/master/CONTRIBUTING.md)
      in the `hoodie` repository (press the little pen Icon) and edit the line 220 as shown below
      
      ```diff
      @@ -220,7 +220,7 @@ If you have commit access, please follow this process for merging patches and cu
          1. If there is a breaking change, make sure that `BREAKING CHANGE:` with
          _exactly_ that spelling (incl. the \":\") is in body of the according
          commit message. This is _very important_, better look twice :)
      -   2. Make sure there are `fix: ...` or `feat: ...` commits depending on wether
      +   2. Make sure there are `fix: ...` or `feat: ...` commits depending on whether
          a bug was fixed or a feature was added. **Gotcha:** look for spaces before
          the prefixes of ` fix:` and ` feat:`, these get ignored by semantic-release.
          3. Use the \"Rebase and merge\" button to merge the pull request.
      ```
      
    • Now instead of only showing this one step, add the entire content of a first-timers-only issue. You can use this one as a template. Use the dynamic content from above for the "📝 Update ..." step

    • deploy the bot to now

    • test & fix all the things

    • celebrate 🎉

  • Version 2: "on demand"
    Instead of needing to copy & paste the content for a new issue, create a new issue directly from the hapi app. After submitting the URL, show a link to the created issue so it can be reviewed and edited if needed. Use a token by @LowProfileDog for authentication

  • Version 3: "the magic bot"
    Setup a webhook to notify our service about changes. You can use ngrok so that GitHub can reach your local server, or create an app on glitch.com, which lets you host node.js application for free and we can all collaborate on it :) Filter out all events but new branches created that start with first-timers-only. For all new first-timers-only*, automagically create new starter issues as before ✨

  • Version 4: probot 🤖❗️
    probot is a bot framework for GitHub – exactly what we need. Probot takes away a lot of generic implementation that you created manually and instead lets you use something like this to run code each time a branch was created

    module.exports = robot => {
      robot.on('push', (event, context) => {
        // run only for newly created branches that start with "first-timers-"
        if (event.ref_type === 'branch' && /^first-timers-/.test(event.ref)) {
          // create issue here
        }
      });
    };
  • The last step is to setup a continuous deployment of the first-timers-only bot to now from travis whenever something gets merged into master

🤔❓ Questions

Ping us in the Hoodie Chat or on Twitter

@jeanhl
Copy link
Collaborator

jeanhl commented Feb 18, 2017 via email

@sohini-roy
Copy link
Collaborator

I would like to claim this issue!

@gr2m
Copy link
Member Author

gr2m commented Feb 22, 2017

@sohini-roy I’m sorry but it’s already taken :)

@sohini-roy
Copy link
Collaborator

sohini-roy commented Feb 22, 2017

Hey , sorry i didn't know that . I have almost completed version 1 i.e. 7/8 of the given tasks of version 1. So i was wondering to send a pull request :)

@gr2m
Copy link
Member Author

gr2m commented Feb 22, 2017

ooops :) If you like start a pull request and I can give you feedback on it, but then it’d be better to find something else to work on :)

@sohini-roy
Copy link
Collaborator

Thank you :)

I have started a pull request. Hope that's ok?

@gr2m
Copy link
Member Author

gr2m commented Mar 2, 2017

@jsoranno any progress on this? Anything we can help with?

@jsoranno
Copy link
Member

jsoranno commented Mar 4, 2017

@gr2m Hi Gregor! I'm sorry it's taking me so long to get started. Wrapping up my job to start a new one is taking more than I expected. It looks like @sohini-roy would be a great person to take it over. I'd love to contribute once I get more comfortable at my new job. Thanks for being so supportive!!!!

@gr2m
Copy link
Member Author

gr2m commented Mar 4, 2017

Okay :) Let me know when you are looking for something to work on. All the best for your new job :)

@sohini-roy @jeanhl I’d like to give this someone else to work on whom I promised a little project for a while now. If you two are still looking for something to contribute, I’d be happy to find something else? I think @sohini-roy is already busy working on the deployment documentation for linux right now :)

@jeanhl
Copy link
Collaborator

jeanhl commented Mar 4, 2017 via email

@gr2m
Copy link
Member Author

gr2m commented Mar 5, 2017

@jeanhl I’ve pinged you in slack :)

@sohini-roy
Copy link
Collaborator

Thank you @jeanhl for recommending me :)
I am towards the end of documentation @gr2m .I would love to work on a new issue :)

@harpreetsaini19
Copy link

I would like to claim this issue!

@gr2m
Copy link
Member Author

gr2m commented Oct 21, 2017

Harpreet, have you actually read the issue? :) it’s been worked on for a long time now, you are a little too late I’m afraid

@gr2m
Copy link
Member Author

gr2m commented Oct 21, 2017

The first timers app is ready and busy creating first-timers-only issues around GitHub https://github.com/apps/first-timers

Great work @agonzalez0515 & @Techforchange

@gr2m gr2m closed this as completed Oct 21, 2017
@harpreetsaini19
Copy link

@gr2m Oh my bad, Sorry, but the issue was open and i just got confused by the available label which was added 2 days back. I would like to work on any open issue, can you suggest any?

@gr2m
Copy link
Member Author

gr2m commented Oct 21, 2017

Oh you are right, I missed that. It was added by mistake, sorry for that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants