Overview

I had the opportunity to send email notifications for GitHub Actions processing results, so here are my notes.

This time we’ll use Gmail. The following was helpful as a reference.

https://stackoverflow.com/questions/69947109/sending-email-with-github-actions

Gmail Configuration

The details are described at the following link. Enable two-factor authentication and create an app password.

https://github.com/dawidd6/action-send-mail?tab=readme-ov-file#gmail

Here is an example of app password configuration.

Local Testing

Use act to run GitHub Actions in a local environment.

https://github.com/nektos/act

Create a file like the following in a repository.

nojanom:bsese:[:nrspdutNu-neosmsptha-si]io:flni::cniuwauafsitbm:etiueshon:s::ssupstfbntueesauorouScdrresb:odW-ecavvrsjmyolneweenwe$::HTCCBB$radsirraoc{ehoore{ktsd__mrt{$|lemmas{fem(daped:s{lmmntlsa)6do::e{odiicsoti/drDc,etthrewl#art$$ersp::ecce:{{peellgrTts{{ltco$i$aehis4ssosry{n{rtio:6eey.em{k{dssn5ccmMte:s.-srreAsngg,MlsmeenI.tihiAiettttLMtttInnpss_AphthLed...CTIrupu_-gMMoOLobsbFemmAAm}_c.:.RnaaIIp}FesrOsiiLLlRsh/eMull__eOsagfr@.UPtMi}evcSAef}t}}s3oESd}o}h}mRS}rutNW-bhAOt.eMR$hcED{eoe}}{mm}}r/age$iip{lto{hsiuigsbti.otorrhneyulpbyo$.s{rsi{eetpnogotrisytiihtf}uo}brd.yerpe}lp}oo/yscmioetmnomtriyts/u}$c}{c{eheagdsistbheuebn.sshuacc}e}ssfullycompleted.

I was able to use secrets with the following command.

actpush-secret-file.secrets

So prepare a file like the following.

MMMMAAAAIIIILLLL____UPTFSAORES=ORSaMNWb=AOcSMR@eEDen==xdxaaexamrxap@alNgeamb.maboeibrlbg.,ccdocemcfc@edxdadmdple.org

As a result, I was able to send emails as follows.

%W[[[[[[[[[[[ANNNNNNNNNNNaRooooooooooocNttttttttttttiiiiiiiiiiifffffffffffpiiiiiiiiiiiucccccccccccsYaaaaaaaaaaahotttttttttttuiiiiiiiiiiiooooooooooo-annnnnnnnnnnsreeWWWWWWWWWWWcooooooooooorurrrrrrrrrrreskkkkkkkkkkktifffffffffff-nlllllllllllfgoooooooooooiwwwwwwwwwwwlA///////////epssssssssssspeeeeeeeeeee.lnnnnnnnnnnnseddddddddddde-----------cMmmmmmmmmmmmr-aaaaaaaaaaaesiiiiiiiiiiitelllllllllllsr]]]]]]]]]]]ie🚀u🏁ss🐳i🐳🐳R🐳🐳cSnuJhtgnoiadddgddSbproDooiMooutcocctacccsakckkikkcuniekeecneeecdmrerrlrrscaroSseygpAcrneceeoeuuruenpx-du=ltendeeclha'scMdhaCtihmraatioemtaccivtmnati=mnehafigpl/degimesx=Snhega=:x[eoa=gc/xnntccaea//odkau=tg.dsettcticemprthahtaae/hetehcicuenthuhvlibhthabeafuaiec./rincchkca/etkaaeocrduetcrmtu:rik///nca/oeudd/ocunrbaaantb/uwwct-ufuniitalnobtdd/iatruuddantun:66cee:dta/-trsaoucaaitcc:tccoatka-ttnr-ecliisclrtaoo/ha-tnnditple--ateuassswesltteeictlenndtspddduptl--6rlamm-eaptaaa,tlfiicfaolltyotr'@iorfmvoumo=#3n=r/-mmersiu=nedegstfsnheer=tdtrnyv=-ntp3/mearovanmyiaicepnrlo=ot/@ui=rvnfn[u3tot"ner=tmrc[aaae"iciiPtltnsua"/.sliajull"cse="-t]stfir""ouwu-nshef"sei"//rldd=e"ea/vwwrd/iouendrnvudkn/l6dinl-inu"argl]c=lta"cic]motdn.c=-m[sId]ef=n[ds]-om,aitlr@yv3r/unningitwith-container-architecturelinux/amd64'.
DxTHTCCBBexoehoorepx:lemmasllmmnto<xodiicyxx,etthrmxxp::eexllgn@oxiratgyxnermmxkfdCae:ssoin/,mlthhp.telcptaeorpdtmosse>c:dem2s/a-0sgi2inx4ftxohx1rub1t.9hceom1r/9en:pa5ok2saimtuorray19x6x/xgeh_aesdibteoern/csoumcmciets/sxfxuxllycompleted.

Verifying Failure Behavior

For verifying failure behavior, using run: exit 1 as follows seemed to work well.

nojanom:bsese:[:nrspdutNu-neosmsptha-si]io:flni::cnrniniuwauauafoafsitbmnm:mm:etiue:eieshon::st:f::ssupstfbnteutaeesauorouIxSceSidrresb:odW-niecdelavvrsjmyolttne)nuweenwe$::HTCCBPB$raedsdrirraoc{ehoorle{ktn1sed__mrt{$|lemmaes{fetm(F(daped:{lrmmnatlsia)a)6do::s{oeiicssotoii/drDe,ttherewnl#lart$$ecsw::ecauce:{{prealcgrlTrts{{lecs$i$haeheis4otr{n{ertFio:6ssysea{k{cdsasMn5eem.t:ks.ia-scceMsfgg,MllismrrnA.aihitAileteetIMittthInnpttLAlhtheLed.ssF_Iuupu_-g..aTLrbsbGFemmMMiO_e.:.iRnaaAAlFsrtOsiiIIe}Rih/eHMullLLd}Onagfur@.__Mib}evcUP-t}t}}s3oSA}h}h}AmES$}euctRS{bthNW{#d.ieAOecoMRg<poneEDiulmsmtso/a}}hey$li}}urm{olb@e{g.ensirxtgseaifpmptoooprhrnslouliecbmyt.e.oocsrrsroseeeympn>fodt}ose}rititaftoihrldeyse.pr}le}op/yocmsoeimntmtoirtsy/u$c${c{{e{egdgisitthhuubb..srheapo}s}itory}}.

Registering Secrets

After finishing local testing, push the changes to GitHub. At that time, I registered secrets using the GitHub CLI gh command as follows.

gggghhhhsssseeeeccccrrrreeeettttsssseeeettttMMMMAAAAIIIILLLL____UPTFSAORESORSMNW-AObMRo-EDdbyod--"ybbaoob"ddcSyy@een""xdxaaexamrxap@alNgeamb.maboeibr"lbg.,ccdocemcf"c@edxdadmdp"le.org"

Summary

While sending notifications to Slack may be more common, I hope this serves as a useful reference.