Skip to content

Commit

Permalink
Set Filename attachment (#28)
Browse files Browse the repository at this point in the history
* set filename of attachments

* Add Gmail Doc. Less Secure Access app access is going away
  • Loading branch information
JaSiLez authored Apr 11, 2022
1 parent 0560836 commit 8ee2734
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ Changes in Gmail settings may be necessary to get this action to work.
Users who have had problems have reported success by doing each of these three steps or by doing the first two steps and using a Gmail account that didn't have 2FA enabled.
##### Instead of using your normal Google password, use an App password.
1. [Enable 2-Step Verification.](https://support.google.com/accounts/answer/185839?hl=en&co=GENIE.Platform%3DAndroid).
This is needed to create an App password.
2. [Create an App password](https://support.google.com/accounts/answer/185833?hl=en) for `Mail`.

### Unauthenticated login (username/password fields)

The parameters `username` and `password` are set as optional to support self-hosted runners access to on-premise infrastructure. If
Expand Down
3 changes: 2 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const core = require("@actions/core")
const glob = require("@actions/glob")
const fs = require("fs")
const showdown = require("showdown")
const path = require("path")

function getBody(bodyOrFile, convertMarkdown) {
let body = bodyOrFile
Expand Down Expand Up @@ -33,7 +34,7 @@ function getFrom(from, username) {
async function getAttachments(attachments) {
const globber = await glob.create(attachments.split(',').join('\n'))
const files = await globber.glob()
return files.map(f => ({ path: f, cid: f.replace(/^.*[\\\/]/, '')}))
return files.map(f => ({ filename: path.basename(f), path: f, cid: f.replace(/^.*[\\\/]/, '')}))
}

async function main() {
Expand Down

0 comments on commit 8ee2734

Please sign in to comment.