fastlane-plugin-teams_card 0.1.1 → 1.0.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 +46 -5
- data/lib/fastlane/plugin/teams_card/actions/teams_card_action.rb +22 -55
- data/lib/fastlane/plugin/teams_card/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4003ed21a14b91be8b3aa4baf4d7af316bbf9030a70a0f259dd7706cfa49f11f
|
4
|
+
data.tar.gz: 2598117c03da52bc03b7110afe3930af99bf89a87457500ace5faabaec8dd24f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5369980097336eeff75f8db7d61bae66ed3b7deb92ce120dd9619fb1f696b5259b48b0da43259e7b35b79e5764a56682b22d134c230e7080a18b7c0737cb3128
|
7
|
+
data.tar.gz: d848efdaee8cfb7ecdaae15dbaf4147338bf6077caed21b3b8de0a9c881e1cd69a293dceb915121824b85997d071fd5e84facf47409de4d0a454156e6bd8def8
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Microsoft Teams fastlane
|
1
|
+
# Microsoft Teams `fastlane` plugin via Workflow
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/fastlane-plugin-teams_card)
|
4
4
|
|
@@ -14,14 +14,15 @@ fastlane add_plugin teams_card
|
|
14
14
|
|
15
15
|
## About teams_card
|
16
16
|
|
17
|
-
With this plugin you will be able to send
|
17
|
+
With this plugin you will be able to send messages to a Microsoft Teams channel, group chat or chat. This plugin utilizes the latest **Workflows** app (rather than the [now-retired Office connectors](https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/) used in other plugins).
|
18
18
|
|
19
|
-
Beforehand you must Set up an incoming webhook workflow from a template in Microsoft Teams channel of your choice. You can follow this documentation to help you do this: [Incoming Webhook](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498)
|
20
19
|
|
21
|
-
`teams_card` allows you to send a fully custom message to a specific incoming webhook.
|
20
|
+
`teams_card` allows you to send a fully custom message to a specific incoming webhook. You can use a predefined card with optional elements like a title, an image, or a button to open a URL. It's also possible to fully customize the card using JSON. It utilizes [Adaptive Cards](https://adaptivecards.io/samples/).
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
24
|
+
To get started, first, [set up an incoming webhook workflow from a template](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498) in Microsoft Teams.
|
25
|
+
|
25
26
|
```ruby
|
26
27
|
teams_card(
|
27
28
|
workflow_url: 'https://your.logic.azure.com:443/workflows/1234567890',
|
@@ -55,10 +56,36 @@ teams_card(
|
|
55
56
|
)
|
56
57
|
```
|
57
58
|
|
58
|
-
This code
|
59
|
+
This code produces the following message:
|
59
60
|
|
60
61
|
<img src="screenshots/1.png">
|
61
62
|
|
63
|
+
### Custom Adaptive cards
|
64
|
+
|
65
|
+
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!
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
teams_card(
|
69
|
+
workflow_url: "https://your.logic.azure.com:443/workflows/1234567890",
|
70
|
+
custom_card: {
|
71
|
+
"type" => "AdaptiveCard",
|
72
|
+
"body" => [
|
73
|
+
{
|
74
|
+
"type" => "TextBlock",
|
75
|
+
"text" => "Custom message content!",
|
76
|
+
"wrap" => true
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"$schema" => "http://adaptivecards.io/schemas/adaptive-card.json",
|
80
|
+
"version" => "1.2"
|
81
|
+
}
|
82
|
+
)
|
83
|
+
```
|
84
|
+
|
85
|
+
This code produces the following message:
|
86
|
+
|
87
|
+
<img src="screenshots/2.png">
|
88
|
+
|
62
89
|
### Help
|
63
90
|
|
64
91
|
Once installed, information and help for an action can be printed out with this command:
|
@@ -77,6 +104,7 @@ fastlane action teams_card
|
|
77
104
|
| `text` | The message you want to display | `TEAMS_MESSAGE_TEXT` | |
|
78
105
|
| `facts` | Optional facts (assigned to, due date, status, branch, environment, etc.) | `TEAMS_MESSAGE_FACTS` | `[]` |
|
79
106
|
| `open_url` | Optional URL for a button at the bottom of the card | `TEAMS_MESSAGE_OPEN_URL` | |
|
107
|
+
| `custom_card` | Optional JSON to fully customize your card. | `TEAMS_MESSAGE_CUSTOM_CARD` | |
|
80
108
|
| `workflow_url` | The URL of the incoming Webhook you created in Workflows app | `TEAMS_MESSAGE_WORKFLOW_URL` | |
|
81
109
|
|
82
110
|
|
@@ -86,6 +114,19 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
|
|
86
114
|
|
87
115
|
**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
116
|
|
117
|
+
## Run tests for this plugin
|
118
|
+
|
119
|
+
To run both the tests, and code style validation, run
|
120
|
+
|
121
|
+
```
|
122
|
+
rake
|
123
|
+
```
|
124
|
+
|
125
|
+
To automatically fix many of the styling issues, use
|
126
|
+
```
|
127
|
+
rubocop -a
|
128
|
+
```
|
129
|
+
|
89
130
|
## Issues and Feedback
|
90
131
|
|
91
132
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-teams_card
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kondamon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|