DEV Community

loading...

Github Workflow to change Smart Bulb color to RED on Pull Request

vj profile image Vasu Jain Updated on ・2 min read

Change lightings on a Pull request in Github (or a Push request)

We all get very busy while focusing on fixing that bug or building a new feature but what if something as urgent as a code push or a pull request comes your way.

Red Bulb

This workflow which talks to your IOT devices in this specific implementation LIFX Smart bulbs, does notify certain actions on Github by changing bulb color.

This Github Workflow changes Smart Bulb color to RED on Pull Request (and Green on Merge - This part is WIP)

Future integration in progreas:

  1. Changing Yellow color for the bulb on merge conflict event
  2. Applause or cheers sent via Alexa as a speaker (Alexa push voice capability)
  3. Brew coffee using the IOT smart plugs (TP link/Wyze etc)

This was the most basic implementation we could do in whatever time we could get for this hackathon. (The entire team spent close to 4-5 hours only to bring it in this state)

Submission Category:

DIY Deployments, Interesting IoT, Phone Friendly, Wacky Wildcards

Yaml File and Link to Code

Link to Code

Please feel free to check it, fork it and ask me anything, here is the repo:

step to run on local machine's IntellJ:

Main Class: io.vertx.core.Launcher

VM Options: -Dapp.spring.properties.file=config/application.properties -Dvertx.options.maxEventLoopExecuteTime=100000000000000

Program Arguments: run gh.hack.rest.verticles.MainVerticle -conf config/application-config.json

Module: rest

For Dev hack : https://dev.to/devteam/announcing-the-github-actions-hackathon-on-dev-3ljn




Yaml File

# Workflow to help you get started with Actions

name: CI

# Control when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch (push/pull)
on:
  push:
    branches:  master
  pull:
    branches:  master

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Running Github Workflow for Push/Pull!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.

      - name: Hit curl
        uses: wei/curl@master
        with:
          args:  http://54.161.236.73:8888/github/event?repoId=rep1



https://github.com/gh-hack-2020/super-secret-app/blob/master/.github/workflows/iotAction.yml

Additional Resources / Info

Collaborators:
Vasu Jain (Product, Architect, Dev)
Pranav Saxena (Lead Developer)

Discussion

pic
Editor guide
Collapse
pooran profile image
Pooran Prasad Rajanna

This is a good idea!

Collapse
rjvm profile image
RJ-vm

This can bring so much fun to work.
It can be adapted into a game to increase employer engagement or improve team bonding.
Another application for it which has immense scope is edutainment industry.

Collapse
vj profile image
Vasu Jain Author

oh great suggestions. Thanks a lot.

Collapse
accodestar profile image
AC-codestar

How cool! @vj is there a short video to see how it works ?