Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Email subject

Email body

### `type`

Email body MIME type

### `attachment`

Filename of the attachment
Expand All @@ -39,6 +43,7 @@ uses: cinotify/github-action@main
with:
to: 'example@example.com'
subject: 'building main'
body: 'This is a notification from GitHub actions.'
body: '<em>This is a notification from GitHub actions.</em>'
type: 'text/html'
attachment: 'artifacts.zip'
```
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ inputs:
description: 'Email subject'
body:
description: 'Email body'
type:
description: 'Email body MIME type'
attachment:
description: 'Email attachment'
outputs:
Expand Down
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const core = require('@actions/core');
const mime = require('mime');
const { email } = require('@cinotify/js');
const {readFileSync} = require('fs');

try {
const to = core.getInput('to');
const subject = core.getInput('subject');
const body = core.getInput('body');
const payload = {to, subject, body};
const type = core.getInput('type');
const payload = {to, subject, body, type};

const attachmentPath = core.getInput('attachment');
if (attachmentPath) {
Expand All @@ -20,7 +20,14 @@ try {
payload.attachments = [attachment];
}

email(payload).then(() => {
fetch('https://www.cinotify.cc/api/notify', {
body: JSON.stringify(payload),
headers: {
'Content-Type': 'application/json',
'User-Agent': `@cinotify/github-action@${process.env['GITHUB_ACTION_REF']}`
},
method: 'POST'
}).then(() => {
core.setOutput("status", "ok")
}).catch(err => {
core.setFailed(err.message)
Expand Down
36 changes: 0 additions & 36 deletions node_modules/.package-lock.json

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

29 changes: 0 additions & 29 deletions node_modules/@cinotify/js/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions node_modules/@cinotify/js/index.js

This file was deleted.

26 changes: 0 additions & 26 deletions node_modules/@cinotify/js/package.json

This file was deleted.

Loading