OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
translate deploy comment, allow to be made by manually set github user
Markus Kahl80007dd48b5a
diff --git a/modules/github_integration/app/workers/cron/check_deploy_status_job.rb b/modules/github_integration/app/workers/cron/check_deploy_status_job.rbindex d40f52c5f5f..7f63cdd1f9e 100644--- a/modules/github_integration/app/workers/cron/check_deploy_status_job.rb+++ b/modules/github_integration/app/workers/cron/check_deploy_status_job.rb@@ -78,6 +78,8 @@ module Cron# PRs are ever checked for their deployment status.def update_deploy_status(pull_request, deploy_target)host = deploy_target.host+ pr_link = "[#{pull_request.repository}##{pull_request.number}](#{pull_request.github_html_url})"+ deploy_target_link = "[#{host}](https://#{host})"ActiveRecord::Base.transaction dodelete_status_check pull_request, deploy_target@@ -86,7 +88,7 @@ module Croncomment_on_referenced_work_packages(pull_request.work_packages,comment_user,- "[#{pull_request.repository}##{pull_request.number}](#{pull_request.github_html_url}) deployed to [#{host}](https://#{host})"+ I18n.t("text_pull_request_deployed_to", pr_link:, deploy_target_link:))endend@@ -102,10 +104,16 @@ module Cronend##- # Ideally this would be the github user, but we don't really have a way- # to identify it outside of the webhook request cycle.+ # We don't have a proper way to identify it outside of the webhook request cycle.+ # So, we added this optional setting (which is lacking a UI) as a workaround for now.def comment_user- User.system+ user_id = plugin_settings[:github_user_id].presence++ user_id ? User.find(user_id) : User.system+ end++ def plugin_settings+ Hash(Setting.plugin_openproject_github_integration).with_indifferent_accessenddef deploy_status_check(deploy_target, pull_request)diff --git a/modules/github_integration/config/locales/en.yml b/modules/github_integration/config/locales/en.ymlindex 182110277b5..13aafa165bb 100644--- a/modules/github_integration/config/locales/en.yml+++ b/modules/github_integration/config/locales/en.yml@@ -46,3 +46,4 @@ en:text_deploy_target_api_key_info: >An OpenProject [API key](docs_url)belonging to a user who has the global introspection permission.+ text_pull_request_deployed_to: "%{pr_link} deployed to %{deploy_target_link}"diff --git a/modules/github_integration/lib/open_project/github_integration/engine.rb b/modules/github_integration/lib/open_project/github_integration/engine.rbindex dade0ae8dc2..5e176ba798f 100644--- a/modules/github_integration/lib/open_project/github_integration/engine.rb+++ b/modules/github_integration/lib/open_project/github_integration/engine.rb@@ -35,6 +35,14 @@ module OpenProject::GithubIntegrationinclude OpenProject::Plugins::ActsAsOpEngine+ def self.settings+ {+ default: {+ "github_user_id" => nil+ }+ }+ end+initializer "github.feature_decisions" doOpenProject::FeatureDecisions.add :deploy_targetsend@@ -42,7 +50,8 @@ module OpenProject::GithubIntegrationregister("openproject-github_integration",author_url: "https://www.openproject.org/",- bundled: true+ bundled: true,+ settings:) do::Redmine::MenuManager.map(:admin_menu) do |menu|menu.push :admin_github_integration,