Skip to content

Commit

Permalink
publish on github
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelvicio committed Mar 5, 2020
0 parents commit 4572098
Show file tree
Hide file tree
Showing 1,881 changed files with 1,147,722 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
[pull_request]

name: Check

jobs:
check:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run tests
run: |
npm ci
npm run test
Empty file added .github/workflows/main.yml
Empty file.
27 changes: 27 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches:
- master

name: Package

jobs:
check:
name: Package distribution file
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
- name: Package
run: |
npm ci
npm run test
- name: Commit
run: |
git config --global user.name "GitHub Actions"
git add dist/
git add node_modules/
git commit -m "chore: Update dist" || echo "No changes to commit"
git push origin HEAD:master
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Twilio SMS GitHub Action

Send an SMS from GitHub Actions.

## Prerequisites

- A AWS Account. [Sign up for free](https://aws.amazon.com)
- A [A AmazonSNS User](https://aws.amazon.com/pt/iam/)

## Usage

1. Set up your credentials as secrets in your repository settings using `AWS_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `FROM_PHONE_NUMBER`, `SMS_TEXT_CONTENT`

2. Add the following to your workflow

```yml
- name: "Sending SMS Notification"
uses: twilio-labs/actions-sms@v1
with:
FROM_PHONE_NUMBER: "+5561123456789"
SMS_TEXT_CONTENT: "Hello from AWS SNS"
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
```
## Inputs
### `FROM_PHONE_NUMBER`

**Required** Phone number to send the SMS to

### `SMS_TEXT_CONTENT`

**Required** The message you want to send

### `AWS_REGION`

A AWS Region. Can alternatively be stored in environment

### `AWS_ACCESS_KEY_ID`

A AWS Access Key ID. Can alternatively be stored in environment

### `TWILIO_API_SECRET`

A Twilio API Secret. Can alternatively be stored in environment

## Outputs

### `messageSid`

The SID of the [message resource](https://www.twilio.com/docs/sms/api/message-resource#message-properties) associated with the SMS sent.

## 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: "AWS SNS"
author: "rafaelvicio"
description: "Send an SMS from GitHub Actions using AWS SNS"
inputs:
FROM_PHONE_NUMBER:
description: "Phone number to send the SMS to"
required: true
SMS_TEXT_CONTENT:
description: "The message you want to send"
required: true
AWS_REGION:
description: "A AWSN SNS Region. Can alternatively be stored in environment"
required: true
AWS_ACCESS_KEY_ID:
description: "A AWS SNS Key. Can alternatively be stored in environment"
required: true
AWS_SECRET_ACCESS_KEY:
description: "A AWS SNS Secret. Can alternatively be stored in environment"
required: true
outputs:
messageID:
description: "The AWS SNS Message ID"
runs:
using: "node12"
main: "dist/index.js"
branding:
color: "orange"
icon: "message-circle"
44 changes: 44 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _core = require('@actions/core'); var _core2 = _interopRequireDefault(_core);
var _awssdk = require('aws-sdk'); var _awssdk2 = _interopRequireDefault(_awssdk);
// import github from "@actions/github";

_awssdk2.default.config.update({
region: "us-east-1",
accessKeyId: "AKIAQHRRSO6JTAOIFSH6",
secretAccessKey: "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"
});

//AKIAQHRRSO6JTAOIFSH6
//8ud7NHsYDGdl9b8NAght2Bc2SyM01MoQt/fA0z4L

async function run() {
const params = {
Message: "Esse é um teste" /* required */,
PhoneNumber: "+5561981359421"
};

const publishTextPromise = new _awssdk2.default.SNS({ apiVersion: "2010-03-31" })
.publish(params)
.promise();

publishTextPromise
.then(function(data) {
console.log("MessageID is " + data.MessageId);
})
.catch(function(err) {
console.error(err, err.stack);
});
}

async function execute() {
try {
return await run();
} catch (error) {
_core2.default.error("Failed to send message", message);
_core2.default.setFailed(message);
}
}

exports. default = execute;

execute();
1 change: 1 addition & 0 deletions node_modules/.bin/sucrase

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/sucrase-node

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/uuid

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

45 changes: 45 additions & 0 deletions node_modules/.yarn-integrity

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

140 changes: 140 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.

Loading

0 comments on commit 4572098

Please sign in to comment.