Skip to content

Commit

Permalink
Add Mailgun send email github action
Browse files Browse the repository at this point in the history
  • Loading branch information
lahirumaramba committed Mar 29, 2021
1 parent 2a5b7f6 commit 83f4405
Show file tree
Hide file tree
Showing 6 changed files with 2,482 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/actions/send-email/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Send Email GitHub Action

This is a minimalistic GitHub Action for sending emails via Mailgun.
Specify the Mailgun API key along with the Mailgun domain and message to
be sent.

## Inputs

### `api-key`

**Required** Mailgun API key.

### `domain`

**Required** Mailgun domain name.

### `from`

Senders name and email address 'Hello User <hello@example.com>'.

### `to`

**Required** Recipient's email address. You can use commas to separate multiple recipients.

### `cc`

Email addresses to Cc.

### `subject`

**Required** Message subject.

### `text`

Text body of the message.

### `html`

HTML body of the message.

## Example usage

```
- name: Send Email
uses: firebase/firebase-admin-node/.github/actions/send-email
with:
api-key: ${{ secrets.MAILGUN_API_KEY }}
domain: ${{ secrets.MAILGUN_DOMAIN }}
from: 'User <you@yourdomain.com>'
html: '<h1>Testing some Mailgun awesomness!</h1>'
to: 'foo@example.com'
```

## Implementation

This Action uses the `mailgun.js` NPM package to send Emails.

When making a code change remember to run `npm run pack` to rebuild the
`dist/index.js` file which is the executable of this Action.
44 changes: 44 additions & 0 deletions .github/actions/send-email/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Send email Action'
description: 'Send emails using Mailgun from GitHub Actions workflows.'
inputs:
api-key:
description: Mailgun API key.
required: true
domain:
description: Mailgun domain name.
required: true
from:
description: Senders name and email address 'Hello User <hello@useremail.com>'.
required: false
to:
description: Recipient's email address. You can use commas to separate multiple recipients.
required: true
cc:
description: Email addresses to Cc.
required: false
subject:
description: Message subject.
required: true
text:
description: Text body of the message.
required: false
html:
description: HTML body of the message.
required: false
runs:
using: 'node12'
main: 'dist/index.js'
Loading

0 comments on commit 83f4405

Please sign in to comment.