Skip to content

Commit

Permalink
Merge pull request #1 from plivo/review
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
nixonsam authored May 25, 2021
2 parents 1f31372 + e1f1617 commit 8e45c69
Show file tree
Hide file tree
Showing 1,710 changed files with 1,077,737 additions and 2 deletions.
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# actions-sms
Plivo github actions
# Plivo SMS GitHub Action

This action can be applied to your workflow and will enable you to send an SMS in any scenario you wish.

## Prerequisites

- A Plivo Account. [Sign up for free](https://console.plivo.com/accounts/register/)
- A [Plivo Auth_ID and Auth_Token](https://console.plivo.com/dashboard/)

## Usage

1. Set up your credentials as [secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) in your repository settings using `PLIVO_AUTH_ID`, `PLIVO_AUTH_TOKEN`, `FROM_NUMBER`,`TO_NUMBER`

2. Add the following to your workflow

```yml
- name: 'Sending SMS Notification'
uses: plivo/action-sms@v1
with:
fromPhoneNumber: ${{ secrets.FROM_NUMBER }}
toPhoneNumber: ${{ secrets.TO_NUMBER }}
message: '💡There has been new release to ${{ github.repository }}'
env:
PLIVO_AUTH_ID: ${{ secrets.PLIVO_AUTH_ID }}
PLIVO_AUTH_TOKEN: ${{ secrets.PLIVO_AUTH_TOKEN }}
```
## Inputs
### `fromPhoneNumber`

**Required** The Phone number in your Plivo account to send SMS from, which is stored as [secret](https://docs.github.com/en/actions/reference/encrypted-secrets) and can also be hardcoded.

### `toPhoneNumber`

**Required** The phone number to which SMS must be sent, is stored as a [secret](https://docs.github.com/en/actions/reference/encrypted-secrets) and can also be hardcoded.

### `message`

**Required** The text message you want to send.

### `PLIVO_AUTH_ID`

**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`

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

## Outputs

Plivo returns a JSON response acknowledging the message.
### `Sample Output`

```
MessageResponse {
apiId: 'de46ab04-b21d-11eb-80f8-0242ac110006',
message: 'message(s) queued',
messageUuid: [ 'de485472-b21d-11eb-80f8-0242ac110006' ]
}
```
## Contributing
## Third Party Licenses
This GitHub Action uses a couple of Node.js modules to work.
License and other copyright information for each module are included in the release branch of each action version under `node_modules/{module}`.
More information for each package can be found at `https://www.npmjs.com/package/{package}`
## License
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Plivo SMS'
author: 'Plivo'
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.'
required: true
toPhoneNumber:
description: 'The phone number to which SMS must be sent, is stored as a secret and can also be hardcoded.'
required: true
message:
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.'
required: true
PLIVO_AUTH_TOKEN:
description: 'A Plivo Auth Token. To be stored in secret or as an environment variable.'
required: true
outputs:
MessageResponse:
description: 'Plivo returns a JSON response acknowledging the message.'
runs:
using: 'node12'
main: 'dist/main.js'
branding:
color: 'green'
icon: 'message-circle'
32 changes: 32 additions & 0 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"use strict";
const core = require("@actions/core");
const plivo = require("plivo");
async function run() {
const from = core.getInput("fromPhoneNumber");
const to = core.getInput("toPhoneNumber");
const message = core.getInput("message");
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;
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);
})
.catch(function (response) {
throw response;
});
return response;
}
async function execute() {
try {
return await run();
}
catch (response) {
core.error("Failed to send message", response);
core.setFailed(response);
}
}
module.exports = execute;
execute();
1 change: 1 addition & 0 deletions node_modules/.bin/semver

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

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

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

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

9 changes: 9 additions & 0 deletions node_modules/@actions/core/LICENSE.md

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

202 changes: 202 additions & 0 deletions node_modules/@actions/core/README.md

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

16 changes: 16 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

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

Loading

0 comments on commit 8e45c69

Please sign in to comment.