rstudio / blastula

Easily send great-looking HTML email messages from R
https://pkgs.rstudio.com/blastula
Other
548 stars 85 forks source link

Helper function to send email for GHA with default information #269

Open cderv opened 3 years ago

cderv commented 3 years ago

This follows a discussion with @rich-iannone

This could useful for example to send an email on failure to different recipient. I have some workflow that runs daily to check everything still works as expected so getting notification of failure would be helpful.

I would see something as simple as this in the workflow

      - name: Send email
        if: failure()
        run: |
          blastula::email_from_gha()
        shell: Rscript {0}

which would retrieve some information from the workflow env var to fill a template It would require the email adress as argument if info can't be retrieved easily from R, from the workflow context (or using API ?)

It could use https://www.smtp2go.com/ as it seems to be the best option (but limitation of the free tier)

It may already be possible to be notified for an action failure but I am not sure it works for anyone but the workflow creator. Also, I don't think there is any way to customize the type of notification. This would allow it.

There is this actions that already exists: https://github.com/marketplace/actions/send-email However every field is required but that would work ok I guess.

Maybe blastula is not the place for this but I feel it would be helpful for R users (like having easy customization using a Rmd template for blastula in .github/workflows/assets/email-notification.Rmd for example).

Anyways, opening the idea here in case I am not the only one to be interested 😉