review_request 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "time"
4
+ require "uri"
5
+ require_relative "cache"
6
+ require_relative "errors"
7
+ require_relative "http_client"
8
+ require_relative "retry"
9
+ require_relative "support"
10
+
11
+ module ReviewRequest
12
+ # GitHub REST API client for pull requests and team review requests.
13
+ class GitHub
14
+ API_URL = "https://api.github.com"
15
+ IGNORED_AUTHORS = ["dependabot[bot]"].freeze
16
+ SECONDS_PER_DAY = 86_400
17
+
18
+ # Shared across instances, like the Python package's class-level cache.
19
+ CACHE = Cache.new(max_size: 200, ttl: 300)
20
+
21
+ attr_reader :token, :organization, :repo, :pull_request_number
22
+
23
+ def initialize(token:, organization:, repo:, pull_request_number: nil, use_cache: true, http: HTTPClient.new)
24
+ if [token, organization, repo].any? { |value| Support.blank?(value) }
25
+ raise GitHubError, "Missing required parameters"
26
+ end
27
+
28
+ @token = token
29
+ @organization = organization
30
+ @repo = repo
31
+ @pull_request_number = pull_request_number
32
+ @use_cache = use_cache
33
+ @http = http
34
+ end
35
+
36
+ def repo_url
37
+ "#{API_URL}/repos/#{organization}/#{repo}"
38
+ end
39
+
40
+ def pr_details
41
+ get(pull_request_url)
42
+ end
43
+
44
+ # Comma-separated "@team" names of teams requested as reviewers, or "" on failure.
45
+ def pr_reviewers
46
+ teams = get("#{pull_request_url}/requested_reviewers").fetch("teams", [])
47
+ teams.map { |team| "@#{team["name"]}" }.join(", ")
48
+ rescue APIError => e
49
+ ReviewRequest.logger.error("Failed to get PR reviewers: #{e.message}")
50
+ ""
51
+ end
52
+
53
+ def open_prs(base_branch: "main")
54
+ query = URI.encode_www_form(state: "open", base: base_branch, sort: "updated", direction: "desc", per_page: 100)
55
+ data = get("#{repo_url}/pulls?#{query}")
56
+ data.is_a?(Array) ? data : []
57
+ rescue APIError => e
58
+ ReviewRequest.logger.error("Failed to get open PRs: #{e.message}")
59
+ []
60
+ end
61
+
62
+ # Open PRs (excluding dependabot and drafts) that have `team_slug` among requested teams.
63
+ # Each returned PR also carries a "reviews" array.
64
+ def team_review_requests(team_slug:, base_branch: "main", max_age_days: nil)
65
+ open_prs(base_branch:).each_with_object([]) do |pr, matches|
66
+ number = pr["number"]
67
+
68
+ if IGNORED_AUTHORS.include?(pr.dig("user", "login").to_s)
69
+ ReviewRequest.logger.info("Skipping PR ##{number} authored by a bot")
70
+ next
71
+ end
72
+ if pr["draft"]
73
+ ReviewRequest.logger.info("Skipping draft PR ##{number}")
74
+ next
75
+ end
76
+ if max_age_days && self.class.calculate_pr_age_days(pr["created_at"].to_s) > max_age_days
77
+ ReviewRequest.logger.info("Skipping PR ##{number}: older than #{max_age_days} days")
78
+ next
79
+ end
80
+ next unless team_requested?(number, team_slug)
81
+
82
+ matches << pr.merge("reviews" => reviews(number))
83
+ end
84
+ end
85
+
86
+ def self.calculate_pr_age(created_at)
87
+ created = parse_time(created_at)
88
+ return "unknown age" unless created
89
+
90
+ total = [(Time.now - created).to_i, 0].max
91
+ days, remainder = total.divmod(SECONDS_PER_DAY)
92
+ hours = remainder / 3600
93
+ minutes = remainder / 60
94
+
95
+ if days.positive?
96
+ "#{days} day#{"s" unless days == 1} old"
97
+ elsif hours.positive?
98
+ "#{hours} hour#{"s" unless hours == 1} old"
99
+ else
100
+ "#{minutes} minute#{"s" unless minutes == 1} old"
101
+ end
102
+ end
103
+
104
+ def self.calculate_pr_age_days(created_at)
105
+ created = parse_time(created_at)
106
+ return 0 unless created
107
+
108
+ [(Time.now - created).to_i, 0].max / SECONDS_PER_DAY
109
+ end
110
+
111
+ def self.parse_time(value)
112
+ Time.parse(value.to_s)
113
+ rescue ArgumentError
114
+ nil
115
+ end
116
+
117
+ private
118
+
119
+ def pull_request_url
120
+ raise GitHubError, "pull_request_number is required for this call" if Support.blank?(pull_request_number)
121
+
122
+ "#{repo_url}/pulls/#{pull_request_number}"
123
+ end
124
+
125
+ def team_requested?(number, team_slug)
126
+ teams = get("#{repo_url}/pulls/#{number}/requested_reviewers").fetch("teams", [])
127
+ teams.any? { |team| team["slug"] == team_slug }
128
+ rescue APIError => e
129
+ ReviewRequest.logger.warn("Failed to get reviewers for PR ##{number}: #{e.message}")
130
+ false
131
+ end
132
+
133
+ def reviews(number)
134
+ data = get("#{repo_url}/pulls/#{number}/reviews")
135
+ data.is_a?(Array) ? data : []
136
+ rescue APIError => e
137
+ ReviewRequest.logger.warn("Failed to get reviews for PR ##{number}: #{e.message}")
138
+ []
139
+ end
140
+
141
+ def get(url)
142
+ if @use_cache
143
+ cached = CACHE.get(url)
144
+ return cached unless cached.nil?
145
+ end
146
+
147
+ data = Retry.with_retries { fetch(url) }
148
+ CACHE.set(url, data) if @use_cache
149
+ data
150
+ end
151
+
152
+ def fetch(url)
153
+ response = @http.get(url, headers: {
154
+ "Authorization" => "token #{token}",
155
+ "Accept" => "application/vnd.github.v3+json"
156
+ })
157
+ unless response.status == 200
158
+ raise GitHubError.new("GitHub API error: #{response.status} for URL: #{url}", status: response.status)
159
+ end
160
+
161
+ response.json
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "net/http"
5
+ require "openssl"
6
+ require "uri"
7
+ require_relative "errors"
8
+
9
+ module ReviewRequest
10
+ # Minimal JSON-over-HTTPS client built on Net::HTTP (no extra gem needed).
11
+ # Transport failures are raised as APIError with status nil, which counts as transient.
12
+ class HTTPClient
13
+ OPEN_TIMEOUT = 10
14
+ READ_TIMEOUT = 20
15
+
16
+ Response = Struct.new(:status, :body) do
17
+ def ok?
18
+ status.between?(200, 299)
19
+ end
20
+
21
+ def json
22
+ return @json if defined?(@json)
23
+
24
+ @json = begin
25
+ JSON.parse(body)
26
+ rescue JSON::ParserError
27
+ nil
28
+ end
29
+ end
30
+ end
31
+
32
+ def get(url, headers: {}, basic_auth: nil)
33
+ perform(Net::HTTP::Get, url, headers:, basic_auth:)
34
+ end
35
+
36
+ def post_json(url, body:, headers: {}, basic_auth: nil)
37
+ perform(Net::HTTP::Post, url, headers:, basic_auth:, body: JSON.generate(body))
38
+ end
39
+
40
+ private
41
+
42
+ def perform(request_class, url, headers:, basic_auth:, body: nil)
43
+ uri = URI(url)
44
+ request = request_class.new(uri, default_headers(body).merge(headers))
45
+ request.basic_auth(*basic_auth) if basic_auth
46
+ request.body = body if body
47
+
48
+ response = build_http(uri).request(request)
49
+ Response.new(response.code.to_i, response.body.to_s)
50
+ rescue Net::OpenTimeout, Net::ReadTimeout, SocketError, SystemCallError, IOError,
51
+ OpenSSL::SSL::SSLError, Timeout::Error => e
52
+ raise APIError.new("HTTP request to #{url} failed: #{e.class}: #{e.message}", status: nil)
53
+ end
54
+
55
+ def default_headers(body)
56
+ headers = { "Accept" => "application/json" }
57
+ headers["Content-Type"] = "application/json; charset=utf-8" if body
58
+ headers
59
+ end
60
+
61
+ def build_http(uri)
62
+ http = Net::HTTP.new(uri.host, uri.port)
63
+ http.use_ssl = uri.scheme == "https"
64
+ http.open_timeout = OPEN_TIMEOUT
65
+ http.read_timeout = READ_TIMEOUT
66
+ http
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "errors"
4
+ require_relative "http_client"
5
+
6
+ module ReviewRequest
7
+ # Jira Cloud REST client (JQL search only).
8
+ class Jira
9
+ SEARCH_FIELDS = %w[summary assignee duedate status project issuetype].freeze
10
+
11
+ attr_reader :site
12
+
13
+ def initialize(site:, email:, api_token:, http: HTTPClient.new)
14
+ @site = site.to_s.delete_suffix("/")
15
+ @email = email
16
+ @api_token = api_token
17
+ @http = http
18
+ end
19
+
20
+ def search_issues(jql, max_results: 100)
21
+ response = @http.post_json(
22
+ "#{site}/rest/api/3/search/jql",
23
+ body: { jql:, maxResults: max_results, fields: SEARCH_FIELDS },
24
+ basic_auth: [@email, @api_token]
25
+ )
26
+ unless response.ok?
27
+ raise JiraError.new("Jira search failed: #{response.status} #{response.body}", status: response.status)
28
+ end
29
+
30
+ response.json || raise(JiraError.new("Jira search returned a non-JSON response", status: response.status))
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "date_checker"
4
+ require_relative "errors"
5
+ require_relative "jira"
6
+ require_relative "messages"
7
+ require_relative "slack"
8
+ require_relative "support"
9
+
10
+ module ReviewRequest
11
+ # Posts a Slack alert listing in-progress Jira issues that are past their due date.
12
+ class JiraOverdueReminderService
13
+ DEFAULT_JQL = 'statusCategory = "In Progress" AND duedate < now() AND type != Epic ORDER BY duedate ASC'
14
+ BOT_NAME = "Jira Reminder"
15
+ DEFAULT_BOT_ICON = "https://github.com/github.png"
16
+
17
+ def initialize(jira_site:, jira_email:, jira_api_token:, slack_token:, app_url: "")
18
+ @jira_site = jira_site.to_s.delete_suffix("/")
19
+ @jira_email = jira_email
20
+ @jira_api_token = jira_api_token
21
+ @slack_token = slack_token
22
+ @app_url = app_url.to_s
23
+ end
24
+
25
+ # Returns the alert text, or nil when there are no overdue issues or the config is incomplete.
26
+ def generate_reminder_message(team_config)
27
+ config = Support.symbolize_keys(team_config)
28
+ if Support.blank?(config[:channel_id])
29
+ ReviewRequest.logger.warn("Incomplete team configuration: #{team_config}")
30
+ return nil
31
+ end
32
+
33
+ jql = Support.presence(config[:jira_jql]) || DEFAULT_JQL
34
+ data = Jira.new(site: @jira_site, email: @jira_email, api_token: @jira_api_token).search_issues(jql)
35
+ issues = data.fetch("issues", [])
36
+ return nil if issues.empty?
37
+
38
+ slack = Slack.new(token: @slack_token)
39
+ members_cache = {}
40
+ lines = [Messages.jira_overdue_intro(slack_group_id: config[:slack_group_id], total_issues: issues.size), ""]
41
+ issues.each do |issue|
42
+ mention = assignee_mention(slack, config[:slack_group_id], issue.dig("fields", "assignee"), members_cache)
43
+ lines << format_issue_line(issue, mention)
44
+ end
45
+ lines.join("\n").strip
46
+ rescue ReviewRequest::Error => e
47
+ ReviewRequest.logger.error("Failed to generate Jira reminder message: #{e.message}")
48
+ nil
49
+ end
50
+
51
+ # Posts the alert for one team. Returns true on success or when there's nothing to send,
52
+ # and false if an error occurred. With dry_run: true, the message is logged instead of posted.
53
+ def send_reminder(team_config, dry_run: false)
54
+ config = Support.symbolize_keys(team_config)
55
+ unless DateChecker.should_send_reminder?(config[:remind_date])
56
+ ReviewRequest.logger.info("Skipping Jira reminder: not a configured reminder day")
57
+ return true
58
+ end
59
+
60
+ message = generate_reminder_message(config)
61
+ unless message
62
+ ReviewRequest.logger.info("No overdue in-progress Jira issues for team config")
63
+ return true
64
+ end
65
+
66
+ if dry_run
67
+ ReviewRequest.logger.info("DRY RUN - Would send message to #{config[:channel_id]}:\n#{message}")
68
+ return true
69
+ end
70
+
71
+ Slack.new(token: @slack_token, channel_ids: [config[:channel_id]])
72
+ .post_message(message, username: BOT_NAME, icon_url: bot_icon_url)
73
+ ReviewRequest.logger.info("Sent Jira overdue reminder to #{config[:channel_id]}")
74
+ true
75
+ rescue ReviewRequest::Error => e
76
+ ReviewRequest.logger.error("Failed to send Jira reminder: #{e.message}")
77
+ false
78
+ end
79
+
80
+ private
81
+
82
+ def bot_icon_url
83
+ base = @app_url.strip.delete_suffix("/")
84
+ base.empty? ? DEFAULT_BOT_ICON : "#{base}/jira-overdue-bot.png"
85
+ end
86
+
87
+ def format_issue_line(issue, mention)
88
+ key = issue["key"].to_s
89
+ fields = issue["fields"] || {}
90
+ summary = fields["summary"] || "Untitled"
91
+ status = (fields["status"] || {})["name"].to_s
92
+ due = Support.blank?(fields["duedate"]) ? "no due date" : fields["duedate"]
93
+ url = key.empty? ? "#" : "#{@jira_site}/browse/#{key}"
94
+ "• [#{key}] <#{url}|#{summary}> – status #{status} – due #{due} – assignee #{mention}"
95
+ end
96
+
97
+ # Mentions the assignee in Slack when they're in the configured usergroup; otherwise uses their name.
98
+ def assignee_mention(slack, slack_group_id, assignee, members_cache)
99
+ return "Unassigned" unless assignee
100
+
101
+ email = assignee["emailAddress"]
102
+ display = Support.presence(assignee["displayName"]) || email || "Unassigned"
103
+ return display if Support.blank?(email)
104
+
105
+ uid = slack.lookup_user_by_email(email)
106
+ return display if Support.blank?(uid) || Support.blank?(slack_group_id)
107
+
108
+ members = members_cache[slack_group_id] ||= slack.usergroup_members(slack_group_id)
109
+ members.include?(uid) ? "<@#{uid}>" : display
110
+ rescue APIError => e
111
+ ReviewRequest.logger.warn("Failed to resolve Slack mention for #{email}: #{e.message}")
112
+ display
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "time"
4
+ require_relative "errors"
5
+ require_relative "messages"
6
+ require_relative "slack"
7
+ require_relative "support"
8
+
9
+ module ReviewRequest
10
+ # Posts a summary to Slack when a Jira sprint is closed.
11
+ class JiraSprintNotificationService
12
+ SPRINT_CLOSED_EVENT = "sprint_closed"
13
+
14
+ def initialize(slack_token:)
15
+ @slack_token = slack_token
16
+ end
17
+
18
+ # Posts the sprint summary to `channel_id`. Returns { ok:, channel:, ts: }.
19
+ def send_notification(channel_id:, sprint_name:, start_date:, end_date:, completed_by:)
20
+ message = Messages.sprint_completed(
21
+ sprint_name:,
22
+ start_date: format_date(start_date),
23
+ end_date: format_date(end_date),
24
+ completed_by:
25
+ )
26
+ ReviewRequest.logger.info("Sending sprint completion notification for '#{sprint_name}' to #{channel_id}")
27
+
28
+ response = Slack.new(token: @slack_token, channel_ids: [channel_id])
29
+ .post_message(message, username: "Jira Sprint Bot", icon_emoji: ":jira:")
30
+ .first
31
+ { ok: response["ok"], channel: response["channel"], ts: response["ts"] }
32
+ rescue APIError => e
33
+ raise SprintNotificationError, "Failed to send sprint notification: #{e.message}"
34
+ end
35
+
36
+ # Handles a parsed Jira webhook payload (string keys). Only "sprint_closed" events are sent;
37
+ # any other event returns nil.
38
+ def process_webhook(channel_id:, webhook_data:)
39
+ unless webhook_data["webhookEvent"] == SPRINT_CLOSED_EVENT
40
+ ReviewRequest.logger.info("Ignoring Jira webhook event '#{webhook_data["webhookEvent"]}'")
41
+ return nil
42
+ end
43
+
44
+ sprint = webhook_data["sprint"] || {}
45
+ user = webhook_data["user"]
46
+ send_notification(
47
+ channel_id:,
48
+ sprint_name: sprint["name"] || "Unknown Sprint",
49
+ start_date: sprint["startDate"],
50
+ end_date: sprint["endDate"],
51
+ completed_by: user ? (user["displayName"] || "Unknown User") : "Unknown User"
52
+ )
53
+ end
54
+
55
+ private
56
+
57
+ def format_date(value)
58
+ return "N/A" if Support.blank?(value)
59
+
60
+ Time.parse(value.to_s).strftime("%B %d, %Y")
61
+ rescue ArgumentError
62
+ ReviewRequest.logger.warn("Failed to parse date #{value}")
63
+ value
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ReviewRequest
4
+ # Slack message templates. Placeholders use {name} and are filled by Messages.render.
5
+ module MessageTemplates
6
+ ICONS = %w[
7
+ :pepe_love:
8
+ :thankabunch:
9
+ :pepelove:
10
+ :awthanks:
11
+ :pepe-evil:
12
+ :pepe-happy:
13
+ :lovee:
14
+ :pepepray:
15
+ :pepe-businessman:
16
+ :cat-nodding:
17
+ :vayvay:
18
+ :prayge:
19
+ :yaya:
20
+ :thankyou_:
21
+ :frog-flower:
22
+ :panda-super-saiyan:
23
+ :pepebongo:
24
+ :amaze:
25
+ :thank_u:
26
+ :thanks-bowing-bugcat:
27
+ :thankyouuuu:
28
+ :camon:
29
+ :camon2:
30
+ ].freeze
31
+
32
+ REVIEW_REQUEST = [
33
+ "Hey team, could you help to review {user_mention}PR?\n" \
34
+ "<{pr_url}|[{repo_name}] {title}>\n" \
35
+ "{reviewers_section}" \
36
+ "Thanks so much for the support! {icon}",
37
+ "Hey all, {user_mention}is looking for your awesome feedback on this PR: \n" \
38
+ "<{pr_url}|[{repo_name}] {title}>\n" \
39
+ "{reviewers_section}" \
40
+ "Could you help to review? Thanks in advance! {icon}",
41
+ "Someone call the code police, {user_mention}pushed this PR: \n" \
42
+ "<{pr_url}|[{repo_name}] {title}>\n" \
43
+ "{reviewers_section}" \
44
+ "Can you help interrogate it with a review? {icon}",
45
+ "Hey heroes, {user_mention}dropped this PR from the coding galaxy: \n" \
46
+ "<{pr_url}|[{repo_name}] {title}>\n" \
47
+ "{reviewers_section}" \
48
+ "Let's give it some Earthling feedback! {icon}",
49
+ "Yo legends, {user_mention}uploaded some spicy code: \n" \
50
+ "<{pr_url}|[{repo_name}] {title}>\n" \
51
+ "{reviewers_section}" \
52
+ "Can we cool it down with your review? {icon}",
53
+ "I love coding almost as much as I love when you review PRs {user_mention}dropped one here: \n" \
54
+ "<{pr_url}|[{repo_name}] {title}>\n" \
55
+ "{reviewers_section}" \
56
+ "Mind giving it a quick look? {icon}",
57
+ "Hey team, I love coding but we love clean code more! {user_mention}has this PR: \n" \
58
+ "<{pr_url}|[{repo_name}] {title}>\n" \
59
+ "{reviewers_section}" \
60
+ "Help keep it tidy with your review? {icon}",
61
+ "Ahoy mates! {user_mention}has set code adrift on the open sea: \n" \
62
+ "<{pr_url}|[{repo_name}] {title}>\n" \
63
+ "{reviewers_section}" \
64
+ "Might you lend your sharp eyes and offer a kind review? {icon}",
65
+ "Good day, crew. A fine PR from {user_mention}awaits your wisdom: \n" \
66
+ "<{pr_url}|[{repo_name}] {title}>\n" \
67
+ "{reviewers_section}" \
68
+ "Let us chart its course together with your thoughtful review {icon}",
69
+ "Captain {user_mention}has crafted a new code voyage: \n" \
70
+ "<{pr_url}|[{repo_name}] {title}>\n" \
71
+ "{reviewers_section}" \
72
+ "If you've a moment, your review would help keep us on course {icon}",
73
+ "A treasure of a PR has surfaced, courtesy of {user_mention}has: \n" \
74
+ "<{pr_url}|[{repo_name}] {title}>\n" \
75
+ "{reviewers_section}" \
76
+ "Could you help us inspect it with care and kindness? {icon}",
77
+ "Crew, {user_mention}brings forth a pull request of promise: \n" \
78
+ "<{pr_url}|[{repo_name}] {title}>\n" \
79
+ "{reviewers_section}" \
80
+ "Would you mind giving it a look before we hoist the sails? {icon}",
81
+ "Smooth waters ahead, but only if this PR from {user_mention}is reviewed: \n" \
82
+ "<{pr_url}|[{repo_name}] {title}>\n" \
83
+ "{reviewers_section}" \
84
+ "A kind review from ye would be most appreciated {icon}",
85
+ "A precious bit of code has been unearthed by {user_mention}has: \n" \
86
+ "<{pr_url}|[{repo_name}] {title}>\n" \
87
+ "{reviewers_section}" \
88
+ "Would you offer your review to help polish this gem? {icon}",
89
+ "Avast, good crew! {user_mention}has left this PR on our shores: \n" \
90
+ "<{pr_url}|[{repo_name}] {title}>\n" \
91
+ "{reviewers_section}" \
92
+ "Care to take a stroll through the lines and share your thoughts? {icon}",
93
+ "A new entry in the log from {user_mention}has been found: \n" \
94
+ "<{pr_url}|[{repo_name}] {title}>\n" \
95
+ "{reviewers_section}" \
96
+ "We'd be grateful if you could review this with your steady compass {icon}",
97
+ "Gentlefolk of the code seas, {user_mention}latest pull bears promise: \n" \
98
+ "<{pr_url}|[{repo_name}] {title}>\n" \
99
+ "{reviewers_section}" \
100
+ "A kind review would help bring it to safe harbor {icon}",
101
+ "{user_mention}has released code into the night:\n" \
102
+ "<{pr_url}|[{repo_name}] {title}>\n" \
103
+ "{reviewers_section}" \
104
+ "A review is the only thing standing between this and chaos {icon}",
105
+ "{user_mention}has submitted a PR under the cover of night:\n" \
106
+ "<{pr_url}|[{repo_name}] {title}>\n" \
107
+ "{reviewers_section}" \
108
+ "Review requested. Clean code, clean city {icon}",
109
+ "{user_mention}dropped a PR like a batarang in the dark:\n" \
110
+ "<{pr_url}|[{repo_name}] {title}>\n" \
111
+ "{reviewers_section}" \
112
+ "Target locked. Engage with review precision {icon}",
113
+ "A line of code can change everything. {user_mention}knows this:\n" \
114
+ "<{pr_url}|[{repo_name}] {title}>\n" \
115
+ "{reviewers_section}" \
116
+ "One review could save production from the brink {icon}"
117
+ ].freeze
118
+
119
+ REMINDER = [
120
+ "Hey {team_mention} 👋\n" \
121
+ "🐢 {total_pr} PRs are still waiting for review...\n" \
122
+ "They're growing older... wiser... and slightly passive-aggressive.\n" \
123
+ "Be a hero 🦸 — review them before they write their memoirs.\n",
124
+ "Hey {team_mention} 👋\n" \
125
+ "🧟 {total_pr} undead PRs are shambling through GitHub…\n" \
126
+ "Only your review can lay them to rest ⚰️",
127
+ "Hey {team_mention} 👋\n" \
128
+ "🐢 {total_pr} PRs moving at turtle speed…\n" \
129
+ "Speed them up with a lightning-fast review! ⚡",
130
+ "Hey {team_mention} 👋\n" \
131
+ "📦 {total_pr} PRs just chilling in review queue…\n" \
132
+ "They're starting to unionize. Please help. ✊",
133
+ "Hey {team_mention} 👋\n" \
134
+ "🐶 {total_pr} abandoned PRs looking for a forever reviewer ❤️\n" \
135
+ "Adopt one today. Be a good human.",
136
+ "Hey {team_mention} 👋\n" \
137
+ "⏳ {total_pr} PRs waiting longer than your morning coffee…\n" \
138
+ "Click fast before they spill over ☕",
139
+ "Hey {team_mention} 👋\n" \
140
+ "🧀 {total_pr} PRs aging like fine cheese…\n" \
141
+ "And not the good kind 🧼",
142
+ "Hey {team_mention} 👋\n" \
143
+ "🤖 {total_pr} PRs have become sentient…\n" \
144
+ "They demand feedback… or they will code themselves.",
145
+ "Hey {team_mention} 👋\n" \
146
+ "👻 {total_pr} ghost PRs haunting GitHub at night…\n" \
147
+ "Review them and break the curse 👻🔮",
148
+ "Hey {team_mention} 👋\n" \
149
+ "💅 {total_pr} PRs waiting for their moment\n" \
150
+ "Let's not keep them in wardrobe change forever 👗",
151
+ "Hey {team_mention} 👋\n" \
152
+ "🚀 {total_pr} PRs ready to launch…\n" \
153
+ "Just need your review fuel to take off 🚀"
154
+ ].freeze
155
+
156
+ JIRA_OVERDUE = [
157
+ "Hey {team_mention} 👋\n" \
158
+ "⏰ {total} Jira issues are past their due date…\n" \
159
+ "Before they start a support group, let's move them forward.",
160
+ "Hey {team_mention} 👋\n" \
161
+ "🧟 {total} overdue issues shambling in 'In Progress'…\n" \
162
+ "Only your action can lay them to rest.",
163
+ "Hey {team_mention} 👋\n" \
164
+ "🐢 {total} tasks moving slower than Monday mornings…\n" \
165
+ "A tiny push today saves a big panic tomorrow.",
166
+ "Hey {team_mention} 👋\n" \
167
+ "🧀 {total} aging like cheese… and not the fancy kind.\n" \
168
+ "Change the status before it gets… aromatic.",
169
+ "Hey {team_mention} 👋\n" \
170
+ "🚨 {total} overdue issues pinging the timeline radar\n" \
171
+ "Let's clear the airspace.",
172
+ "Hey {team_mention} 👋\n" \
173
+ "📦 {total} stories waiting in the delivery truck…\n" \
174
+ "A quick update and they're on the road.",
175
+ "Hey {team_mention} 👋\n" \
176
+ "🕰️ {total} tickets time-traveled past their due date…\n" \
177
+ "Send them back to the present with an update.",
178
+ "Hey {team_mention} 👋\n" \
179
+ "🔥 {total} smoldering tasks in 'In Progress'…\n" \
180
+ "A quick status douses the flames.",
181
+ "Hey {team_mention} 👋\n" \
182
+ "🧩 {total} pieces waiting to click into Done…\n" \
183
+ "One move from you completes the puzzle.",
184
+ "Hey {team_mention} 👋\n" \
185
+ "🌧️ {total} clouds hanging over the sprint…\n" \
186
+ "Mark some sunshine with a status change.",
187
+ "Hey {team_mention} 👋\n" \
188
+ "📣 {total} issues calling from the backlog hotline…\n" \
189
+ "They'd like to speak to a human.",
190
+ "Hey {team_mention} 👋\n" \
191
+ "🛰️ {total} signals from overdue orbit…\n" \
192
+ "Bring them back to Earth with an update.",
193
+ "Hey {team_mention} 👋\n" \
194
+ "🏃 {total} tasks stuck at mile 25…\n" \
195
+ "A tiny push gets them over the finish line.",
196
+ "Hey {team_mention} 👋\n" \
197
+ "🔧 {total} work-in-progress needing a quick tune-up…\n" \
198
+ "Tighten a bolt, change a status, done.",
199
+ "Hey {team_mention} 👋\n" \
200
+ "📅 {total} dates came and went…\n" \
201
+ "Let's not let the sprint retrospective do all the talking.",
202
+ "Hey {team_mention} 👋\n" \
203
+ "🧭 {total} tasks looking for direction…\n" \
204
+ "Point them to Done with a quick update."
205
+ ].freeze
206
+
207
+ SPRINT_COMPLETED = "🎉 *Sprint Completed!* 🎉\n\n" \
208
+ "📋 *Sprint:* {sprint_name}\n" \
209
+ "📅 *Start Date:* {start_date}\n" \
210
+ "📅 *End Date:* {end_date}\n" \
211
+ "👤 *Completed by:* {completed_by}\n\n" \
212
+ "Great job, team! Another sprint successfully completed! 🚀"
213
+ end
214
+ end