Skip to content

Commit

Permalink
Update failure message on http request
Browse files Browse the repository at this point in the history
  • Loading branch information
neonidian committed Apr 24, 2022
1 parent 234dda0 commit 7c1379f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ async function run() {
title,
titleBackgroundColor,
});
core.info('Message has been sent to Teams');
} catch (error) {
core.setFailed(error.message);
}
Expand Down
4 changes: 3 additions & 1 deletion src/requests/post-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const postRequest = async function postMessage(webhookUrl, jsonPayload) {
return await new httpClient.HttpClient().postJson(webhookUrl, jsonPayload, header)
.then(response => {
core.debug(`Received response: "${response.result}" from Teams server`);
if (response.result !== 1) {
if (response.result === 1) {
core.info('Message has been sent to Teams');
} else {
core.setFailed(`Message not sent. Received response from Teams: "${response.result}"`);
}
return response.result;
Expand Down

0 comments on commit 7c1379f

Please sign in to comment.