Skip to content

Commit

Permalink
Send emails to the team on Nightly CI Failure (#14)
Browse files Browse the repository at this point in the history
Reuses the Admin SDK's Send Email action along with Firebase's MailGun credentials to notify the team if the nightly CI fails.
  • Loading branch information
DellaBitta authored Nov 22, 2024
1 parent 817f68e commit 170dfbf
Show file tree
Hide file tree
Showing 6 changed files with 28,434 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 using the Mailgun API.
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`

**Required** Sender's email address. Ex: 'Hello User <[email protected]>' (defaults to 'user@{domain}`).

### `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-sdk-nextjs-tests/.github/actions/send-email
with:
api-key: ${{ secrets.MAILGUN_API_KEY }}
domain: ${{ secrets.MAILGUN_DOMAIN }}
from: 'User <[email protected]>'
html: '<h1>Testing some Mailgun awesomness!</h1>'
to: '[email protected]'
```

## 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 2024 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.
required: true
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: 'node20'
main: 'dist/index.js'
Loading

0 comments on commit 170dfbf

Please sign in to comment.