Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor create_github_summary markdown #237

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-10-28 16:35:08 UTC using RuboCop version 1.66.1.
# on 2024-10-29 16:58:26 UTC using RuboCop version 1.66.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -28,17 +28,9 @@ Metrics/MethodLength:
- 'spec/**/*.rb'
- 'lib/functionality/base_deploy_check.rb'

# Offense count: 11
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantStringEscape:
Exclude:
- 'lib/functionality/base_deploy_check.rb'
- 'lib/functionality/issue_deploy_check.rb'
- 'lib/functionality/pr_deploy_check.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 146
Max: 151
6 changes: 3 additions & 3 deletions lib/functionality/base_deploy_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def self.base_check(config, event, sha)
target_url: config.event_payload['html_url']
)
end
github_summary_message += "Created #{result[:state]} state with description: #{result[:description]}"
github_summary_message += "for sha #{sha} and url #{result[:url]}\n"
github_summary_message += '========================================================================='
github_summary_message += "##### Created #{result[:state]} state with description: #{result[:description]}\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a list

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Updated @addersuk

github_summary_message += "##### for sha #{sha} and url #{result[:url]}\n"
github_summary_message += '##### ========================================================================='
create_github_summary(github_summary_message)
puts "Created #{result[:state]} state with description #{result[:description]}"
print "for sha #{sha} and url #{result[:url]}"
Expand Down
8 changes: 4 additions & 4 deletions lib/functionality/issue_deploy_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def self.create_status_for_all_prs(config, status, message)
context: context_name,
target_url: config.event_payload['html_url']
)
message += "Created #{result[:state]} state with\n"
message += "description #{result[:description]} for PR #{pr.number} and url #{result[:url]}\n"
message += "with target_url #{config.event_payload['html_url']}\n"
message += '============================================================================================ \ '
message += "##### Created #{result[:state]} state with\n"
message += "##### description #{result[:description]} for PR #{pr.number} and url #{result[:url]}\n"
message += "##### with target_url #{config.event_payload['html_url']}\n"
message += '##### ============================================================================================ \ '
create_github_summary(message)
puts "Created #{result[:state]} state with " \
"description #{result[:description]} for PR #{pr.number} and url #{result[:url]} " \
Expand Down
10 changes: 5 additions & 5 deletions lib/functionality/pr_deploy_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def self.check_labeled_pr(config)
context: context_name,
target_url: config.event_payload['html_url']
)
github_summary_message = "Deploy Status Check\n"
github_summary_message = "## Deploy Status Check\n"
github_summary_message += "### :sparkles: You are free to deploy :sparkles:\n"
github_summary_message += " Created #{result[:state]} state with description #{result[:description]} for sha #{sha} and url #{result[:url]}\n"
github_summary_message += " description #{result[:description]} for sha #{sha} for url #{result[:url]}\n"
github_summary_message += " with target_url #{config.event_payload['html_url']}\n "
github_summary_message += ' ============================================================================================'
github_summary_message += "##### Created #{result[:state]} state with description #{result[:description]} for sha #{sha} and url #{result[:url]}\n"
github_summary_message += "##### description #{result[:description]} for sha #{sha} for url #{result[:url]}\n"
github_summary_message += "##### with target_url #{config.event_payload['html_url']}\n "
github_summary_message += '##### ============================================================================================'
create_github_summary(github_summary_message)

puts "Created #{result[:state]} state with" \
Expand Down