feat: link commits, branches and pull requests to tickets

A project can turn on a webhook for GitHub, Gitea or GitLab. Pushes and
pull or merge requests that name a ticket key show on that ticket under
Desarrollo, with the state of each pull request; the secret is shown and
rotated from the project settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 15:28:12 +02:00
parent 24b37b6628
commit 046d77c813
48 changed files with 2638 additions and 12 deletions

View File

@@ -1097,6 +1097,45 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/projects/{project}/git-integration": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Whether the Git webhook is on (and its secret, for admins) */
get: operations["GitController_integration"];
put?: never;
/** Turn the Git webhook on with a new secret (or rotate it) */
post: operations["GitController_enable"];
/** Turn the Git webhook off */
delete: operations["GitController_disable"];
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/webhooks/git/{project}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
put?: never;
/**
* Webhook for GitHub, Gitea or GitLab (called by the Git host)
* @description Push and pull/merge request events. GitHub and Gitea sign the body with the secret (HMAC-SHA256); GitLab sends it as X-Gitlab-Token. Other events are acknowledged and ignored.
*/
post: operations["GitController_receive"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -1417,6 +1456,23 @@ export interface components {
text: string;
done: boolean;
};
/** @enum {string} */
DevLinkKind: "COMMIT" | "BRANCH" | "PULL_REQUEST";
/** @enum {string} */
DevLinkState: "OPEN" | "MERGED" | "CLOSED";
DevLinkDto: {
kind: components["schemas"]["DevLinkKind"];
url: string;
title: string;
/** @description Short SHA, branch or PR number */
ref: string;
state: components["schemas"]["DevLinkState"] | null;
/** @example gitea */
provider: string;
author: string | null;
/** Format: date-time */
at: string;
};
IssueDto: {
/** Format: uuid */
id: string;
@@ -1473,6 +1529,8 @@ export interface components {
/** @description Place in the backlog and its board column (ascending, as text) */
rank: string;
checklist: components["schemas"]["ChecklistItemDto"][];
/** @description Commits, branches and pull requests that mention it */
devLinks: components["schemas"]["DevLinkDto"][];
commentCount: number;
/** Format: date-time */
createdAt: string;
@@ -2029,6 +2087,17 @@ export interface components {
*/
sprintId: string | null;
};
GitIntegrationDto: {
enabled: boolean;
/** @description Webhook secret; only owners and admins see it */
secret: string | null;
/** @example /api/webhooks/git/3f2c… */
webhookPath: string;
};
GitDeliveryResultDto: {
/** @description Tickets that got something new */
recorded: number;
};
};
responses: never;
parameters: never;
@@ -7233,4 +7302,241 @@ export interface operations {
};
};
};
GitController_integration: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["GitIntegrationDto"];
};
};
/** @description Invalid input */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Missing or rejected Pireon token */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not a member of the project (or not allowed) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
};
};
GitController_enable: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["GitIntegrationDto"];
};
};
/** @description Invalid input */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Missing or rejected Pireon token */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not a member of the project (or not allowed) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Someone changed it at the same time: retry */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Business rule (e.g. a transition the workflow forbids) */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
};
};
GitController_disable: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Invalid input */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Missing or rejected Pireon token */
401: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not a member of the project (or not allowed) */
403: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Not found */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Someone changed it at the same time: retry */
409: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
/** @description Business rule (e.g. a transition the workflow forbids) */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ApiErrorDto"];
};
};
};
};
GitController_receive: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Project id or key */
project: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["GitDeliveryResultDto"];
};
};
/** @description Unknown project, integration off or bad signature */
403: {
headers: {
[name: string]: unknown;
};
content?: never;
};
};
};
}