Coder Social home page Coder Social logo

oca-github-bot's Introduction

OCA GitHub bot

The goal of this project is to collect in one place:

  • all operations that react to GitHub events,
  • all operations that act on GitHub repos on a scheduled basis.

This will make it easier to review changes, as well as monitor and manage these operations, compared to the current situations where these functions are spread across cron jobs and ad-hoc scripts.

Table of contents

Auto-delete pull request branch
When a pull request is merged from a branch in the same repo, the bot deletes the source branch.
Repo addons table generator in README.md
For addons repositories, update the addons table in README.md.
Addon README.rst generator
For addons repositories, generate README.rst from readme fragments in each addon directory, and push changes back to github.
Addon icon generator
For addons repositories, put default OCA icon in each addon that don't have yet any icon, and push changes back to github.
setup.py generator
For addons repositories, run setuptools-odoo-make-defaults, and push changes back to github.

These actions are also run nightly on all repos.

When there are two approvals, set the approved label. When the PR is at least 5 days old, set the ready to merge label.

One can ask the bot to perform some tasks by entering special commands as merge request comments.

/ocabot merge optionally followed by one of major, minor, patch, can be used to ask the bot to the following: * rebase the PR on the target branch * run the main branch operations (see above) on it * optionally bump the version number of the addons modified by the PR * merge when tests on the rebased branch are green

See our open issues, pick one and contribute!

The easiest is to look at examples.

New webhooks are added in the webhooks directory. Webhooks execution time must be very short and they should delegate the bulk of their work as delayed tasks, which have the benefit of not overloading the machine and having proper error handling and monitoring.

Tasks are in the tasks directory. They are Celery tasks.

Tasks can be scheduled, in cron.py, using the Celery periodic tasks mechanism.

First create and customize a file named environment, based on environment.sample.

docker-compose up --build will start

  • the bot, listening for webhooks calls on port 8080
  • a celery worker to process long running tasks
  • a celery beat to launch scheduled tasks
  • a flower celery monitoring tool on port 5555

The bot URL must be exposed on the internet through a reverse proxy and configured as a GitHub webhook, using the secret configured in GITHUB_SECRET.

This project uses black as code formatting convention, as well as isort and flake8. To make sure local coding convention are respected before you commit, install pre-commit and run pre-commit install after cloning the repository.

To run tests, type tox. Test are written with pytest.

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

oca-github-bot's People

Contributors

sbidoul avatar fkantelberg avatar miquelrforgeflow avatar hbrunn avatar lmignon avatar pedrobaeza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.