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
Add verbose output to script/github_pr_errors
Christophe Bliard547e490f1308
diff --git a/script/github_pr_errors b/script/github_pr_errorsindex 264f7eacebc..3bd4793ac76 100755--- a/script/github_pr_errors+++ b/script/github_pr_errors@@ -29,7 +29,8 @@ class Optionsdisplay_rerun_info: false,failed_jobs_logs: [],no_cache: false,- run_id: nil+ run_id: nil,+ verbose: false}.freezeBANNER = <<~BANNER.freeze@@ -97,6 +98,11 @@ class Optionsputs parserexitend++ parser.on("-v", "--verbose",+ "Print more information, mostly useful for debugging") do |value|+ options[:verbose] = true+ endendopt_parser.parse!options@@ -104,6 +110,12 @@ class Optionsendend+def say_verbose(text)+ return unless Options.verbose++ warn "| #{text}"+end+# Returns current branchdef current_branch_name@current_branch_name ||= `git rev-parse --abbrev-ref HEAD`.strip@@ -117,6 +129,7 @@ def get_http(path)"#{GITHUB_API_OPENPROJECT_PREFIX}/#{path}"end+ say_verbose("HTTP GET #{url}")response = RestClient::Request.new(method: :get,url:,@@ -124,6 +137,8 @@ def get_http(path)password: ENV.fetch('GITHUB_TOKEN')).execute+ say_verbose("HTTP Response #{response.code}")+response.to_strrescue RestClient::ExceptionWithResponse => ewarn error_details(e)@@ -179,10 +194,12 @@ def cached(unique_name)cached_file = RAILS_ROOT.join("tmp/github_pr_errors/#{unique_name}")if cached_file.file?+ say_verbose("Reading from cached file #{cached_file}")content = cached_file.readcontent.start_with?("---") ? YAML::load(content) : contentelsecontent = yield+ say_verbose("Writing to cached file #{cached_file}")cached_file.dirname.mkpathcached_file.write(content.is_a?(String) ? content : YAML::dump(content))content