Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find a way to get github to send email notifications to the laser team #900

Open
amcewen opened this issue Sep 9, 2018 · 9 comments
Open

Find a way to get github to send email notifications to the laser team #900

amcewen opened this issue Sep 9, 2018 · 9 comments

Comments

@amcewen
Copy link
Member

@amcewen amcewen commented Sep 9, 2018

Not all of the members of the laser maintenance team want to receive emails for every issue/comment/etc. on here, but we need them to receive notifications for any issues which have one of the laser-cutter labels applied.

@amcewen
Copy link
Member Author

@amcewen amcewen commented Sep 9, 2018

I've created a Github team @DoESLiverpool/laser-maintenance. I had wondered if we could then assign issues to it, in order for the team to receive notifications, but that doesn't seem to be the case :-(

So, I think that means we'll need to roll our own. Or look to see if anyone else has built something to solve the problem...

@ajlennon
Copy link
Contributor

@ajlennon ajlennon commented Jan 8, 2019

Initial research indicates webhooks should work for issue events and deal with labels.

I'll put a PoC together involving a node-red flow...

@ajlennon
Copy link
Contributor

@ajlennon ajlennon commented Jan 8, 2019

OK well that seems to work quite well. The major problem is that as a "casual developer" I am apparently no longer allowed to Tweet without jumping through burning hoops of fire.

Anyhoo biting my tongue for the moment...

GitHub Webbooks allow us to propagate events which include events relating to issue creation / label addition and so forth. @see https://developer.github.com/v3/activity/events/types/#issuesevent (@zarino)

(As much as I hate myself for admitting it the whole JS <-> JSON thing is awesome. So much boring work involves parsing. I love how easy it is to map data to object properties although I'm still not entirely convinced that it's at all robust)

So there's a test repo here: https://github.com/DoESLiverpool/a-test-repo

I've put a couple of test issues in there and a label "email-the-directors"

You can add and remove the email and directors@doesliverpool.com will be emailed with what's occurring wrt the issue and the label.

image

Flow looks like this

[{"id":"b84d9180.f08e","type":"http in","z":"c001ab00.dece88","name":"DoES POST Webhook","url":"does-wh","method":"post","upload":false,"swaggerDoc":"","x":320,"y":140,"wires":[["92063602.96f838","1dc77b4c.b81af5","a26f255f.e597a8"]]},{"id":"e2c97951.ae8628","type":"http response","z":"c001ab00.dece88","name":"","statusCode":"","headers":{},"x":800,"y":340,"wires":[]},{"id":"92063602.96f838","type":"function","z":"c001ab00.dece88","name":"Return OK","func":"msg.payload = \"OK\";\n\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":360,"wires":[["e2c97951.ae8628"]]},{"id":"65688c9c.8a97c4","type":"http in","z":"c001ab00.dece88","name":"DoES GET Webhook (Debug)","url":"does-wh","method":"get","upload":false,"swaggerDoc":"","x":340,"y":280,"wires":[["92063602.96f838","1dc77b4c.b81af5"]]},{"id":"1dc77b4c.b81af5","type":"switch","z":"c001ab00.dece88","name":"Check labels","property":"payload.label.name","propertyType":"msg","rules":[{"t":"eq","v":"email-the-directors","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":500,"wires":[["2f398ff5.c2b16"]]},{"id":"fee1fa2b.3503a8","type":"e-mail","z":"c001ab00.dece88","server":"smtp.gmail.com","port":"465","secure":true,"name":"email-to-foo","dname":"Email out","x":1010,"y":500,"wires":[]},{"id":"a26f255f.e597a8","type":"debug","z":"c001ab00.dece88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1000,"y":620,"wires":[]},{"id":"2f398ff5.c2b16","type":"function","z":"c001ab00.dece88","name":"Build a readable payload","func":"msg.topic = \"Something has happened at DoES Liverpool!\"\nmsg.payload = \"User \" + msg.payload.issue.user.login + \" \" + msg.payload.action + \" \" + \"'email-the-directors' on issue '\" + msg.payload.issue.title + \"' (#\" + msg.payload.issue.number + \")\" + \"\\r\\n\\r\\n\" + \"See \" + msg.payload.issue.html_url + \" for details\";\n\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":620,"wires":[["fee1fa2b.3503a8","a26f255f.e597a8"]]}]

If the DMZ / sandboxed area in #932 were looked at we might put a public facing Node-Red DoES infrastructure VPS in place to handle this kind of thing?

@ajlennon
Copy link
Contributor

@ajlennon ajlennon commented Jan 16, 2019

Any more thoughts on this @amcewen ?

@amcewen
Copy link
Member Author

@amcewen amcewen commented Jan 16, 2019

I think it'd be better to comment on the issue rather than send an email, in this case - because...

  • we don't have an email alias set up for the laser maintainers but we do have a github team and apparently if you mention @DoESLiverpool/laser-maintenance then the members will get a notification email from github :-D
  • if we use github notifications then they won't get two emails if they've already got their github notifications set to email them for any activity

And then we'll need to set up the publicly accessible NodeRED instance. I wonder if sticking it on the VPS running https://organisers.doesliverpool.com would work, as it's a pretty easy install with Docker (which that's using to run FabManager)?

For a completely different approach (which I only learnt about a day or so ago), you could set up a Github Action, which seems to be a way to get Github to run a script when certain events happen (including adding a label). There's a walkthrough of it at [https://blog.jessfraz.com/post/the-life-of-a-github-action/], which I've not finished reading yet :-)

@ajlennon ajlennon self-assigned this Jun 24, 2019
@ajlennon
Copy link
Contributor

@ajlennon ajlennon commented Jun 24, 2019

Been trying to find this one for a while. Have assigned myself so I can find it again and will try to do something #HackTheSpace

@arthurrowland
Copy link

@arthurrowland arthurrowland commented Aug 16, 2021

This week's featured issue! @ajlennon how are you feeling about this one now?

@ajlennon
Copy link
Contributor

@ajlennon ajlennon commented Aug 16, 2021

Yeah could do. Where are we with all this stuff now ?

@MatthewCroughan
Copy link
Member

@MatthewCroughan MatthewCroughan commented Aug 16, 2021

Teams on Github have "discussions". You could make an issue here and then put a link to the issue in the Github Discussion for the laser team. I know it's really not really optimal, but maybe it makes more sense?

I've made an example on https://github.com/orgs/DoESLiverpool/teams/laser-maintenance

Do you not think that the transient and temporary nature of the laser cutter's maintenance works better as a Github Discussion rather than an Issue anyway?

@ajlennon ajlennon removed their assignment Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants