/
slack_file_client.rb
39 lines (33 loc) · 1.12 KB
/
slack_file_client.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'fastlane_core/ui/ui'
require_relative './file_loader'
module Fastlane
module Helper
class SlackFileClient
include Helper::FileLoader
SLACK_MESSAGE_FORMAT_DEFAULT = {
'text' => 'Hello, its beautiful day!',
'header' => 'Hi there, Just wanted to let you know that we have MR_TOTAL merge requests that need your attention.',
'mr_item' => '<MR_LINK|MR_TITLE> MR_ASSIGNEE_SINGLE',
'footer' => 'Thank you',
'empty_mr_text' => 'Congratulation there is no merge request anymore, keep the good works'
}.freeze
def message_format(filepath)
UI.message 'Load slack message format'
load_json(filepath, SLACK_MESSAGE_FORMAT_DEFAULT)
end
def users(filepath)
UI.message 'Load slack users'
slack_users = load_csv_to_hash(
filepath,
'Gitlab User ID',
'Name',
'Slack ID',
'name',
'slack_id'
)
UI.success 'Slack users nil, skipped using tag user `@user` in when posting message reminder in slack' if slack_users.nil?
slack_users
end
end
end
end