DEV Community

Cover image for Are They Awake Yet? Building a GitHub Action to Find Out!
Ben Greenberg
Ben Greenberg

Posted on

Are They Awake Yet? Building a GitHub Action to Find Out!

Have you ever wanted to know when tagging someone on a GitHub issue or pull request if they might be awake? πŸ•°οΈπŸ˜΄

Clearly, if someone is awake, it does not automatically mean they must respond in real-time to your comment. Nonetheless, it would be nice to know if you could reasonably expect a response given the current time in their location.

This weekend GitHub launched a month-long GitHub Actions Hackathon. I recently started getting into the process of building actions, by first building one that checks for inclusive language against a user-maintained list and then building another action to automatically import your DEV posts to your Jekyll site.

Actions are language agnostic automated workflows that can accomplish anything you might want to build them for. Your imagination defines what you can accomplish, and, of course, the limits of the technology.

Going back to the question of figuring out if someone might be awake. I decided to build an action to tackle that question. πŸ§°πŸ› οΈ

The Are They Awake Yet? Action uses the location provided by the user in their GitHub profile to discover their date and time. If a user does not provide a location then the action shares that there is no location instead.

How Does It Work?

The action leverages the Google Cloud Platform Geocoding and Time Zone APIs to figure out the date and time.

First, the location provided in the user profile is translated into latitude and longitude coordinates with the Geocoding API. Second, those coordinates are then sent to the Time Zone API to figure out the user's time zone and time offset from UTC time. With that information, the action is able to figure out the exact time and date for the location provided.

Lastly, the action then sends that information as a comment on either the pull request or the issue tagging the questioner and the person inquired in the response.

Using The Action

If you are interested in incorporating this action in any of your repositories on GitHub, you can find it in the GitHub Actions Marketplace.

I also πŸ’™ contributions. If you want to get involved, the code is open-source and available. The action leverages Jason Ecto's actions toolkit and is written in JavaScript.

Top comments (3)

v6 profile image
πŸ¦„N BπŸ›‘

This ended up being a lot less creepy than the impression I got from the title.

ben profile image
Ben Halpern


bengreenberg profile image
Ben Greenberg