Skip to content

oppia/oppiabot

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Oppiabot

Oppiabot is a GitHub app built with probot. It acts as a helper for the Oppia code repository to maintain the development workflow. It is hosted on Heroku.

The bot currently performs the following functions:

  1. Checks whether a contributor creating a pull request has signed the CLA. It adds a label Needs CLA accordingly.

  2. Checks merge conflict in a pull request and notifies the author of the pull request if there is a merge conflict.

  3. Closes stale pull requests.

Getting started

Please refer to the following instructions to setup Oppiabot for the first time on your machine:

  1. Create a new, empty folder called opensource/ within your home folder. Navigate to it (cd opensource), then fork and clone the Oppiabot repo. This will create a new folder named opensource/oppiabot. Navigate to opensource/oppiabot/.

  2. Install Node.Js and NPM on your machine using the following commands:

  sudo apt-get install nodejs
  sudo apt-get install npm

For MacOS, run sudo brew install node to install Node.Js and NPM.

  1. Setup probot and other dependencies by running the following command:
  npm install
  1. The Oppiabot uses environment variables. These are configured in the server settings. To deploy the bot locally, create a .env file and copy the contents of .env.example to it. You will need to adjust these variables accordingly following the instructions in the subsequent steps.

  2. Go to smee.io and click Start a new channel. Set WEBHOOK_PROXY_URL in .env to the URL that you are redirected to.

  3. Create a new GitHub App with:

    • Webhook URL: Use your WEBHOOK_PROXY_URL from the previous step.
    • Webhook Secret: development
    • Permissions & events is located lower down the page and will depend on what data you want the bot to have access to. Currently, the bot requires read and write access to issues and pull requests and read-only access to the file in the path .github/stale.yml. If, for example, you only enable issue events, you will not be able to listen on pull request webhooks with the bot.
  4. Download the private key. It will be a .pem file. Move it to the root directory of the project. As long as it's in the root directory, it will be automatically detected regardless of the filename.

  5. Edit .env and set APP_ID to the ID of the app you just created. The App ID can be found in your app settings page here.

Installing the bot on a repository

You'll need to identify a target repository and install the bot by clicking the Install button on the settings page of your app, e.g https://github.com/apps/your-app-name

Running the bot locally

You are now ready to run the bot on your local machine. Run npm run dev to start the server. The dev script will start the bot using nodemon, which will watch for any files changes in your local development environment and automatically restart the server.

Other available scripts

$ npm start to start the bot without watching files.

Debugging

Always run $ npm install and restart the server if package.json has changed. To turn on verbose logging, start server by running: $ LOG_LEVEL=trace npm start.

Support

If you have any feature requests or bug reports, please log them on our issue tracker.

Please report security issues directly to [email protected].

License

The Oppiabot code is released under the Apache v2 license.