hub.sr.ht/hubsrht
Robin Jarry be5d50d8d8 webhooks: update todo tickets with git commits
Allow referencing tracker tickets in git commit messages via specific
trailer words:

  Fixes: <ticket url>
  Implements: <ticket url>
  References: <ticket url>

These must follow standard git trailer syntax. The trailers are
extracted from commit messages with the function added in previous
commit. The ticket url must point to a valid ticket.

A comment will be inserted in the ticket with a back reference to the
git commit and its original author. The comment will be made by the user
who pushed the commit. E.g.:

  ~arkanoid REPORTED -> FIXED                          9 seconds ago

  John Doe referenced this ticket in commit b4dc4c40.

Open tickets referenced by a Fixes trailer will be resolved with the
FIXED resolution.

Open tickets referenced by an Implements trailer will be resolved with
the IMPLEMENTED resolution.

Caveats:

* Only the 25 most recent commit messages will be considered when
  pushing long series. This should be a fairly sane limitation.

* If the user pushing commits does not have triage/comment permissions
  on the bug tracker, nothing will happen.

* Invalid/non-existent ticket urls are ignored.

* When a git repository is part of more than one project, the webhook
  will run once per project and update the same ticket(s) once per
  project as well.

* If an already resolved ticket is referenced by a Fixes or Implements
  trailer, only a comment will be added.

Link: https://git-scm.com/docs/git-interpret-trailers
Implements: https://todo.sr.ht/~sircmpwn/hub.sr.ht/55
Signed-off-by: Robin Jarry <robin@jarry.cc>
2021-11-29 10:52:32 +01:00
..
alembic Syncronize nullable constraints with service policy 2021-01-18 15:24:59 -05:00
blueprints webhooks: update todo tickets with git commits 2021-11-29 10:52:32 +01:00
templates Remove popular tags 2021-11-28 11:26:59 +01:00
types Syncronize nullable constraints with service policy 2021-01-18 15:24:59 -05:00
app.py Allow trailing slashes on some routes 2020-04-29 10:46:05 -04:00
builds.py Ignore webhooks from someone else's build 2021-02-20 09:53:43 -05:00
decorators.py Implement featured projects 2020-04-28 14:08:56 -04:00
oauth.py Initial commit 2020-03-24 10:26:15 -04:00
projects.py Make project names match [A-Za-z0-9._-]+ 2021-08-11 09:41:50 +02:00
services.py webhooks: update todo tickets with git commits 2021-11-29 10:52:32 +01:00
trailers.py git: add function to parse message trailers 2021-11-29 10:52:31 +01:00