DEV Community

Vasu Jain
Vasu Jain

Posted on • Edited on

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

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



Enter fullscreen mode Exit fullscreen mode

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)

Top comments (4)

Collapse
 
pooran profile image
Pooran Prasad Rajanna

This is a good idea!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.