Skip to content

Commit

Permalink
update: handling catch & README
Browse files Browse the repository at this point in the history
  • Loading branch information
huzaif-plivo committed May 24, 2021
1 parent da5667d commit e1f1617
Show file tree
Hide file tree
Showing 56 changed files with 407,227 additions and 342,489 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ This action can be applied to your workflow and will enable you to send an SMS i

### `PLIVO_AUTH_ID`

A Plivo Auth_ID. To be stored in [secret](https://docs.github.com/en/actions/reference/environments) or as an environment variable.
**Required** A Plivo Auth ID. To be stored in [secret](https://docs.github.com/en/actions/reference/environments) or as an environment variable.

### `PLIVO_AUTH_TOKEN`

A Plivo Auth_Token. To be stored in [secret](https://docs.github.com/en/actions/reference/environments) or as an environment variable.
**Required** A Plivo Auth Token. To be stored in [secret](https://docs.github.com/en/actions/reference/environments) or as an environment variable.

## Outputs

Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Plivo SMS'
author: 'Plivo'
description: 'Send an SMS from GitHub Actions using Plivo Programmable SMS'
description: 'Send an SMS from GitHub Actions using Plivo'
inputs:
fromPhoneNumber:
description: 'The Phone number in your Plivo account to send SMS from, which is stored as secret and can also be hardcoded.'
Expand All @@ -12,10 +12,10 @@ inputs:
description: 'The message you want to send'
required: true
PLIVO_AUTH_ID:
description: 'A Plivo Auth_ID. To be stored in secret or as an environment variable.'
description: 'A Plivo Auth ID. To be stored in secret or as an environment variable.'
required: true
PLIVO_AUTH_TOKEN:
description: 'A Plivo Auth_Token. To be stored in secret or as an environment variable.'
description: 'A Plivo Auth Token. To be stored in secret or as an environment variable.'
required: true
outputs:
MessageResponse:
Expand Down
17 changes: 10 additions & 7 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@ async function run() {
core.debug(from, to, message);
const auth_id = core.getInput("PLIVO_AUTH_ID") || process.env.PLIVO_AUTH_ID;
const auth_token = core.getInput("PLIVO_AUTH_TOKEN") || process.env.PLIVO_AUTH_TOKEN;
var client = new plivo.Client(auth_id, auth_token);
var response = client.messages.create(from, to, message).then(function (response) {
let plivo = require("plivo");
let client = new plivo.Client(auth_id, auth_token);
var response = client.messages.create(from, to, message)
.then(function (response) {
console.log(response);
}, function (error) {
console.error(error);
})
.catch(function (response) {
throw response;
});
return response;
}
async function execute() {
try {
return await run();
}
catch ({ message }) {
core.error("Failed to send message", message);
core.setFailed(message);
catch (response) {
core.error("Failed to send message", response);
core.setFailed(response);
}
}
module.exports = execute;
Expand Down
13 changes: 5 additions & 8 deletions node_modules/typescript/README.md

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

Loading

0 comments on commit e1f1617

Please sign in to comment.