DEV Community

Cover image for A GitHub action to trigger an alarm on your room 🚨
Alfonso Reyes
Alfonso Reyes

Posted on • Updated on

A GitHub action to trigger an alarm on your room 🚨

My journey on the actions hackathon

I'm submitting this post as part of my Actions Hackathon journey and also my participation.

Action in action:

Motivation

I always imagined open-source mantainers as heroes, since they spend lots of their free time just to share their knowledge with useful software and give back to the oss community, many times I've meet people who are passionate about OSS and for me they deserve the best.

So I'm making a simple action (my first one tho!) that is able to trigger an alarm on your room when someone opens up an Issue on your configured repositories, now you can feel like a hero when the city needs you! You may also remix this action to turn on a Batman signal on the ceiling of your room 🦸 🦇 (It's a great idea!)

Issuetron box
I know is not pretty, but it serves it's purpose 👻

Submission Category:

Interesting IoT

Yaml File or Link to Code

on:
  issues:
    types: [opened]

jobs:
  do_iot_thing:
    runs-on: ubuntu-latest
    name: A job to turn on a light when someone opens an issue
    steps:
      - name: Send activation to ESP8266 device
        uses: 'mxarc/issuetron-3000@1.1'
        id: activation
        with:
          time: '15' # how much time we will keep our light on
          blink: true # enable blinking, otherwise just turn on the lamp
          io_user: '${{ secrets.IO_USER }}'
          io_key: '${{ secrets.IO_KEY }}'
          io_feed: 'issuetron'
          send_context: true
      # Use the output from the `hello` step
      - name: Check if we succeeded to turn on the light
        run: echo "The result of the action is ${{ steps.activation.outputs.success }}"
Enter fullscreen mode Exit fullscreen mode

Link to the Action in marketplace:
https://github.com/marketplace/actions/issuetron-3000

Source code

GitHub logo ojoanalogo / issuetron-3000

🚨 Trigger a MQTT alert when someone opens an issue in one of your repositories

issuetron-3000 🚨

🚨 Turn on a light signal on the physical world when an issue is opened on one of your repos

This is my entry for the dev.to GitHub Actions hackathon

Index

About this

This is a really simple action intended to connect the real world with IoT devices connected to Adafruit IO Cloud.

It allows repo mantainers to keep alerted about new issues on their repos, made for the heros of the Open-Source 💙

🔧 I'm using Adafruit IO cloud for the ease of IoT development and device provisioning, since I know most people would like to configure a device the easy way and not have to go through complicated setups like AWS or Azure IoT.

The Action workflow is listening to an…




How I'm making this

🔧 I'm using Adafruit IO cloud for the ease of IoT development and device provisioning, since I know most people would like to configure a device the easy way and not have to go through complicated setups like AWS or Azure IoT.

The Action workflow is listening to an "Issue" event and when it's triggered it gets the issue context (like username and issue title) and sends the content over MQTT protocol to an ESP8266 device which I had lying around, it turns on a red lamp which I got from a auto parts store. 🚨

Action is able to send context about the issue, being those details:

  • issue title
  • issue author
  • repo of origin

You can also disable the issue context if you want to save some bytes or you only want to trigger a custom action on your IoT device.

This action leverages repo secrets, since some variables like the device Key and ID are supposed to be secret, you can find more information on the README on how to setup your device.

Wiring
Example of how to wire your IoT device

In the above image we have a red LED, but I suggest you use another source of light or maybe add a ring bell!

You can see the action in action here:

What I have learned creating this action

I was able to understand the basics of GitHub actions, the hackathon was the perfect motivation to begin learning more about this wonderful tool, I plan to make more IoT related projects in the future that use GitHub actions in one way or another.

The GitHub actions documentation it's the best place to start, don't be afraid to follow it, it covers everything from creating a starter project to deploying your first action.

Top comments (8)

Collapse
 
arturssmirnovs profile image
Arturs Smirnovs

This is a good one :) Thumbs up for idea!

Collapse
 
ojoanalogo profile image
Alfonso Reyes

Thank you! I still need to add more features and I would love to do a video showing the action in action, I believe it's perfect for the upcoming Hacktoberfest event 🤯

Collapse
 
arturssmirnovs profile image
Arturs Smirnovs

I had in old office screen that was connected to raspberry pi and it displayed all issues and status on screen using API..

That was cool stuff as well.. and if pull to master comes in fireworks starts.. :)

Could add up a big bundle for dev teams in office's as fun thingy..

Keep up the good work, let me know maybe in comment later how Hacktoberfest went.. My vote for you! :)

Collapse
 
yellow1912 profile image
yellow1912

We need to get the bat projector for this, haha. Cool one. Love it. I may even do one in the office.

Collapse
 
dcparsons profile image
Doug Parsons

¡Bravo! Buen trabajo, Alfonso.

Collapse
 
ojoanalogo profile image
Alfonso Reyes

¡Muchas gracias Doug! 😀

Collapse
 
developerkaren profile image
Karen Efereyan

This is good Alfonso. Congrats. But I don't understand what's happening ?

Collapse
 
ojoanalogo profile image
Alfonso Reyes

I've updated the post with a video sample of this action working 🥳