fastlane-plugin-teams_card 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +40 -0
- data/lib/fastlane/plugin/teams_card/actions/teams_card_action.rb +22 -55
- data/lib/fastlane/plugin/teams_card/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b229f7cfb58d0bc2158d0b16b61952554e78266cdffdb37aa7db2fa12a9c1ce
|
4
|
+
data.tar.gz: 03c0faf12e34721112ed176a827e0c181e5b304e95a56100653042cabc323380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c5e5f5e5bc2a3ef2ca16aa8068dff16035fa6cfdb9e40f2f960d4498b9dac15c5f2fed33d03a044cf584cf9963dc715edfba97f8460fd3c6b6665e882f5b0b
|
7
|
+
data.tar.gz: 3b8f8b94e0b882f658214b9ade5495c2deb7be4471d01807a707f20c65513b0549fff1987ebcd27771ba193b56ae9ce166ff74196f12e9d2e264317aed30bee5
|
data/README.md
CHANGED
@@ -59,6 +59,32 @@ This code give the following message:
|
|
59
59
|
|
60
60
|
<img src="screenshots/1.png">
|
61
61
|
|
62
|
+
### Custom Adaptive cards
|
63
|
+
|
64
|
+
You can fully customize your cards by providing a custom JSON for AdaptiveCard. Look at the [templates and information on how to customize cards](https://adaptivecards.io/samples/). Note that MS Teams cannot display the latest versions of the schema!
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
teams_card(
|
68
|
+
workflow_url: "https://your.logic.azure.com:443/workflows/1234567890",
|
69
|
+
custom_card: {
|
70
|
+
"type" => "AdaptiveCard",
|
71
|
+
"body" => [
|
72
|
+
{
|
73
|
+
"type" => "TextBlock",
|
74
|
+
"text" => "Custom message content!",
|
75
|
+
"wrap" => true
|
76
|
+
}
|
77
|
+
],
|
78
|
+
"$schema" => "http://adaptivecards.io/schemas/adaptive-card.json",
|
79
|
+
"version" => "1.2"
|
80
|
+
}
|
81
|
+
)
|
82
|
+
```
|
83
|
+
|
84
|
+
This code give the following message:
|
85
|
+
|
86
|
+
<img src="screenshots/2.png">
|
87
|
+
|
62
88
|
### Help
|
63
89
|
|
64
90
|
Once installed, information and help for an action can be printed out with this command:
|
@@ -77,6 +103,7 @@ fastlane action teams_card
|
|
77
103
|
| `text` | The message you want to display | `TEAMS_MESSAGE_TEXT` | |
|
78
104
|
| `facts` | Optional facts (assigned to, due date, status, branch, environment, etc.) | `TEAMS_MESSAGE_FACTS` | `[]` |
|
79
105
|
| `open_url` | Optional URL for a button at the bottom of the card | `TEAMS_MESSAGE_OPEN_URL` | |
|
106
|
+
| `custom_card` | Optional JSON to fully customize your card. | `TEAMS_MESSAGE_CUSTOM_CARD` | |
|
80
107
|
| `workflow_url` | The URL of the incoming Webhook you created in Workflows app | `TEAMS_MESSAGE_WORKFLOW_URL` | |
|
81
108
|
|
82
109
|
|
@@ -86,6 +113,19 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
|
|
86
113
|
|
87
114
|
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
88
115
|
|
116
|
+
## Run tests for this plugin
|
117
|
+
|
118
|
+
To run both the tests, and code style validation, run
|
119
|
+
|
120
|
+
```
|
121
|
+
rake
|
122
|
+
```
|
123
|
+
|
124
|
+
To automatically fix many of the styling issues, use
|
125
|
+
```
|
126
|
+
rubocop -a
|
127
|
+
```
|
128
|
+
|
89
129
|
## Issues and Feedback
|
90
130
|
|
91
131
|
For any other issues and feedback about this plugin, please submit it to this repository.
|
@@ -12,17 +12,20 @@ module Fastlane
|
|
12
12
|
|
13
13
|
# Build the payload for the Teams message
|
14
14
|
def self.build_payload(params)
|
15
|
+
# Use custom card if provided, otherwise build the card dynamically
|
16
|
+
content = params[:custom_card] || {
|
17
|
+
"type" => "AdaptiveCard",
|
18
|
+
"body" => build_card_body(params),
|
19
|
+
"$schema" => "http://adaptivecards.io/schemas/adaptive-card.json",
|
20
|
+
"version" => "1.2"
|
21
|
+
}
|
22
|
+
|
15
23
|
payload = {
|
16
24
|
"type" => "message",
|
17
25
|
"attachments" => [{
|
18
26
|
"contentType" => "application/vnd.microsoft.card.adaptive",
|
19
27
|
"contentUrl" => nil,
|
20
|
-
"content" =>
|
21
|
-
"type" => "AdaptiveCard",
|
22
|
-
"body" => build_card_body(params),
|
23
|
-
"$schema" => "http://adaptivecards.io/schemas/adaptive-card.json",
|
24
|
-
"version" => "1.2"
|
25
|
-
}
|
28
|
+
"content" => content
|
26
29
|
}]
|
27
30
|
}
|
28
31
|
|
@@ -107,13 +110,12 @@ module Fastlane
|
|
107
110
|
|
108
111
|
# Add actions to the payload if needed
|
109
112
|
def self.add_actions_to_payload(payload, open_url)
|
110
|
-
payload["attachments"][0]["content"]["actions"]
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
]
|
113
|
+
payload["attachments"][0]["content"]["actions"] ||= []
|
114
|
+
payload["attachments"][0]["content"]["actions"] << {
|
115
|
+
"type" => "Action.OpenUrl",
|
116
|
+
"title" => "Open",
|
117
|
+
"url" => open_url
|
118
|
+
}
|
117
119
|
end
|
118
120
|
|
119
121
|
# Send the message to the Teams Webhook URL
|
@@ -174,6 +176,12 @@ module Fastlane
|
|
174
176
|
description: "Optional url for a button at bottom of card",
|
175
177
|
optional: true),
|
176
178
|
|
179
|
+
FastlaneCore::ConfigItem.new(key: :custom_card,
|
180
|
+
env_name: "TEAMS_MESSAGE_CUSTOM_CARD",
|
181
|
+
description: "Custom Adaptive Card JSON object",
|
182
|
+
optional: true,
|
183
|
+
type: Hash),
|
184
|
+
|
177
185
|
FastlaneCore::ConfigItem.new(key: :workflow_url,
|
178
186
|
env_name: "TEAMS_MESSAGE_TEAMS_URL",
|
179
187
|
sensitive: true,
|
@@ -185,48 +193,7 @@ module Fastlane
|
|
185
193
|
]
|
186
194
|
end
|
187
195
|
|
188
|
-
|
189
|
-
[
|
190
|
-
'teams_card(
|
191
|
-
workflow_url: "https://your.logic.azure.com:443/workflows/1234567890",
|
192
|
-
title: "Notification Title",
|
193
|
-
text: "A new release is ready for testing!",
|
194
|
-
image: "https://raw.githubusercontent.com/fastlane/boarding/master/app/assets/images/fastlane.png",
|
195
|
-
image_title: "Fastlane",
|
196
|
-
open_url: "https://beta.itunes.apple.com/v1/app/_YOUR_APP_ID_",
|
197
|
-
facts: [
|
198
|
-
{
|
199
|
-
"title" => "Environment",
|
200
|
-
"value" => "Staging"
|
201
|
-
},
|
202
|
-
{
|
203
|
-
"title" => "Release",
|
204
|
-
"value" => "1.0.3"
|
205
|
-
}
|
206
|
-
]
|
207
|
-
)'
|
208
|
-
]
|
209
|
-
end
|
210
|
-
|
211
|
-
def self.description
|
212
|
-
"Easily send a message to a Microsoft Teams channel or group chat through the Power Automate Webhook connector"
|
213
|
-
end
|
214
|
-
|
215
|
-
def self.details
|
216
|
-
"Send a message to a specific channel, group chat or chat on your Microsoft Teams organization via a Workflow of Power Automate"
|
217
|
-
end
|
218
|
-
|
219
|
-
def self.authors
|
220
|
-
["Kondamon"]
|
221
|
-
end
|
222
|
-
|
223
|
-
def self.return_value
|
224
|
-
# If your method provides a return value, you can describe here what it does
|
225
|
-
end
|
226
|
-
|
227
|
-
def self.is_supported?(platform)
|
228
|
-
true
|
229
|
-
end
|
196
|
+
# Rest of the methods...
|
230
197
|
end
|
231
198
|
end
|
232
199
|
end
|