Skip to content

Automatic and well-defined pull request merged based on contribution-based weighted voting

License

Notifications You must be signed in to change notification settings

TooAngel/worlddriven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

world driven

CircleCI discord Code climate

World driven introduces a contribution based weighted voting system for time-based auto-merges. It defines a process and automates the process of merging Pull Requests based on Reviews.

World driven automatically merges Pull Requests after a certain amount of time, this gives interested people time to review and approve or request changes (in world driven speech: vote). Positive votes reduce the time to merge to speed up the release. Previous contributions are the factor of this merge boost (think of number of commits). Voting against the Pull Request increases the time to merge. Reaching a certain threshold blocks the merge.

The default configuration for repositories is:

  • Merge duration for a pull request: 10 days (240 hours)
  • Per commit time: 0 days
  • Merge method: squash

Per-Repository Configuration

Repositories can customize their worlddriven settings by adding a .worlddriven.ini file to the default branch:

[DEFAULT]
baseMergeTimeInHours = 240
perCommitTimeInHours = 0
merge_method = squash

Configuration Options:

  • baseMergeTimeInHours: Base time in hours before merging a PR (default: 240 = 10 days)
  • perCommitTimeInHours: Extra time in hours per commit (default: 0)
  • merge_method: GitHub merge method - merge, squash, or rebase (default: squash)

Worlddriven reads the configuration from the repository's default branch when processing pull requests.

Read more on https://www.worlddriven.org

Issue Labels

We use a comprehensive labeling system to organize issues and pull requests:

Issue Types

  • bug - Something isn't working correctly
  • enhancement - New feature or improvement to existing functionality
  • question - Requires further information or discussion

Issue Status

  • duplicate - This issue or pull request already exists
  • invalid - This doesn't seem right or is not actionable
  • wontfix - We will not work on or change this
  • WIP - Work in progress - do not merge yet

Community

  • help wanted - Community contributions welcome
  • good first issue - Good for newcomers - straightforward task for first-time contributors
  • discussion - Needs discussion or decision before implementation

Technical Categories

  • dependencies - Pull requests that update a dependency file
  • javascript - JavaScript code changes or improvements
  • infrastructure - Infrastructure, deployment, and DevOps tasks
  • security - Security-related issues and vulnerabilities
  • modernization - Modernizing code and dependencies
  • technical-debt - Code cleanup and refactoring tasks
  • monitoring - Monitoring, logging, and observability

Setup

Run with docker compose

Copy .env-example to .env and add your environment variables.

docker compose up

Manual

The application uses MongoDB as back end, the default configuration is localhost:27017 This can be overwritten with the environment variable: MONGODB_URI

Gunicorn serves as the server, checkout the Procfile or use gunicorn --workers=1 --worker-class=flask_sockets.worker server:app --chdir src.

The authentication and authorization uses GitHub OAuth and API.

For OAuth and merging of pull requests create an GitHub OAuth App (https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-an-oauth-app) and set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET as environment variable. The GitHub callback path is: /github-callback.

For commenting create and set a personal token (https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) as: GITHUB_USER_TOKEN

Set Session secret as SESSION_SECRET initial a random string.

To disable https in a local environment set DEBUG=true as environment variable.

Prepare PostgreSQL server

sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;

Testing

Run JavaScript tests with: npm run test Run python tests with: pytest

Configuration

To allow different configurations on different repositories you can place a .worlddriven.ini (see .worlddriven.ini-example) in the root of your repository and adapt the values. When World Driven checks new Pull Requests it fetches the .worlddriven.ini from your default branch (fetching from the Pull Request could be a security issue) and applies the configuration.

Front end

The Front end has three views:

  • / the front page
  • /dashboard a dashboard with an overview of the repositories and a button to enable World Driven for the repository
  • /:org/:repo/pull/:pull_number A detailed calculation breakdown for the pull request

Use the following endpoints to more easily work on the dashboard with mock data:

  • /test/dashboard - for the dashboard
  • /test/:org/:repo/pull/:pull_number - for the pull request view

Production environment

The World Driven auto-merge service is:

  • hosted on Heroku
  • tested via CircleCI,
  • merged via World Driven and automatically deployed.

About

Automatic and well-defined pull request merged based on contribution-based weighted voting

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Contributors 11