Skip to content
Sebastian Wilzbach edited this page Dec 23, 2016 · 10 revisions

A mixture of 2b and 2c was eventually implemented in https://github.com/dlang-bots/dlang-bot/pull/17 However instead of running a cron job permanently it listen to all success CI events and loops over all auto-merge-labelled PRs in the according repo (note that this needs to be done because CI "success" event doesn't contain a reference to the PR). To avoid overusing the API, this is throttled to happen at most every 5.minutes per repository.

  1. Auth via oAuth

  • Problematic as we would need to store all OAuth token for all members of @dlang
  • Heroku isn't a safe place for such critical write-access tokens
  • Running our own server for dlang-bot is an overkill (atm)

2a) Auth via labels

  • Only users with write permissions can add labels (this depends on GH not changing their permissions model in the near future)
  • Provide two labels: auto-merge and auto-merge-squash (the latter will perform a squashed merge)
  • dlang-bot has write-access and will do the merge

Options:

2a) cache label + status events & put the open PRs in a database

-> update database on new events

Problem 1: we might miss an event

2b) on every request: query GH API for label & CI status (2 requests)

Problem 1: we might overuse the API and run in rate limitations

2c) have a cron job that checks for mergeable PRs every X minutes

Problem 1: we might need to send multiple requests as we need to loop over all open PRs and the API only returns 100 results per query

One problem applies to all solutions, we need to ignore potentially failing CIs like CodeCov. Would be ugly to replicate the GH settings what CI is required, but still fairly easily maintainable.