Add OpenProject Gitea integration plugin

Implements a Gitea integration for OpenProject following the same
patterns as the bundled GitHub and GitLab integrations.

- Webhook endpoint at /webhooks/gitea with HMAC-SHA256 verification
- Handles pull_request and issue_comment events
- Links Gitea PRs to work packages via OP# references or URLs
- Posts journal comments on WPs for PR lifecycle events
- Gitea tab on the work package split view
- V3 API endpoint: GET /api/v3/work_packages/:id/gitea_pull_requests
- Admin settings UI for bot user and webhook secret
- Nightly cron job to clean up unlinked PR records
This commit is contained in:
quafzi committed 2026-08-28 22:33:27 +02:00
commit 5d409989df
45 files changed
+2561

No files matched your search

+92
View File
@@ -0,0 +1,92 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
---
en:
activerecord:
attributes:
gitea_pull_request:
labels: "Labels"
errors:
models:
gitea_pull_request:
attributes:
labels:
invalid_schema: "must be an array of hashes with keys: color, name"
models:
gitea_pull_request:
one: "Gitea pull request"
other: "Gitea pull requests"
gitea_user:
one: "Gitea user"
other: "Gitea users"
attributes:
gitea: "Gitea identifier"
gitea_avatar_url: "Avatar URL"
gitea_html_url: "Gitea HTML URL"
gitea_login: "Gitea login"
gitea_name: "Gitea name"
gitea_pull_request: "Pull Request"
gitea_updated_at: "Updated at"
gitea_integration:
pull_request_opened_comment: >
**PR Opened:** Pull request %{pr_number} [%{pr_title}](%{pr_url}) for [%{repository}](%{repository_url})
has been opened by [%{gitea_user}](%{gitea_user_url}).
pull_request_closed_comment: >
**PR Closed:** Pull request %{pr_number} [%{pr_title}](%{pr_url}) for [%{repository}](%{repository_url})
has been closed by [%{gitea_user}](%{gitea_user_url}).
pull_request_merged_comment: >
**PR Merged:** Pull request %{pr_number} [%{pr_title}](%{pr_url}) for [%{repository}](%{repository_url})
has been merged by [%{gitea_user}](%{gitea_user_url}).
pull_request_reopened_comment: >
**PR Reopened:** Pull request %{pr_number} [%{pr_title}](%{pr_url}) for [%{repository}](%{repository_url})
has been reopened by [%{gitea_user}](%{gitea_user_url}).
issue_comment_referenced_comment: >
**Referenced in Comment:** [%{gitea_user}](%{gitea_user_url}) referenced this work package in a
[comment](%{comment_url}) on issue %{issue_number} [%{issue_title}](%{comment_url})
in [%{repository}](%{repository_url}):
%{comment_body}
label_gitea_actor: "Gitea actor"
label_gitea_integration: "Gitea Integration"
label_gitea_webhook_secret: "Webhook secret"
permission_show_gitea_content: "Show Gitea content"
project_module_gitea: "Gitea"
text_gitea_actor_info: >
The OpenProject user whose API key must be used to authenticate incoming webhook requests.
When set, requests authenticated with any other user's credentials are rejected.
This user also posts automated comments on work packages. Defaults to the system user when not set.
text_gitea_webhook_secret_info: >
A secret token shared with Gitea when configuring the webhook.
When set, OpenProject verifies the X-Gitea-Signature header on every incoming request,
rejecting payloads that do not match. Leave blank to skip verification (not recommended).
text_gitea_webhook_secret_missing_warning: >
No webhook secret is configured. Any request to the Gitea webhook endpoint will be accepted
without verification, which may allow unauthorized actors to forge events. It is strongly
recommended to set a secret.
+55
View File
@@ -0,0 +1,55 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
---
en:
js:
gitea_integration:
tab_header_pr:
copy_menu:
description: Copy git snippets to clipboard
label: Git snippets
create_pr:
description: Create a Pull Request
label: Create PR
git_actions:
branch_name: Branch name
cmd: Create branch with empty commit
commit_message: Commit message
copy_error: Copy failed!
copy_success: Copied!
title: Quick snippets for Git
title: "Pull requests"
tab_prs:
empty: There are no pull requests linked yet. Link an existing PR by using the code <code>OP#%{wp_id}</code> in the PR title/description or create a new PR.
updated_on: Updated on
work_packages:
tab_name: "Gitea"
work_packages:
tabs:
gitea: "Gitea"
+37
View File
@@ -0,0 +1,37 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
Rails.application.routes.draw do
namespace "gitea_integration" do
namespace "admin" do
resource :settings, only: %i[show update]
end
end
end