This repository contains a GitHub action name gnotify
that can be used to send notifications to a Google Chat space for GitHub events such as when a new issue is created, a review is requested on a pull request, etc.
There is an official GitHub integration with Google Chat, so why would anyone use gnotify
? If the GitHub account used to connect the a Google Chat space with GitHub has access to more than 100 repositories, and the repository to be connected to the Google Chat space is not in the those 100 repositories, then it does not work. The GitHub integration plug-in is limited to listing 100 repositories. This is a known issue for which there is currently no fix. The response in this bug report implies there is a work-around, but none of the ones listed actually work. Hence, gnotify
.
It is easy to get started with gnotify
with the steps below:
-
Identify the GitHub repository and Google Chat space that will send and receive the notifications.
-
Visit the Google Chat space, click on the downward arrow next to its name, and click on the menu item named Apps & integrations, ex.:
-
Click on the Add webhooks button, ex.:
-
Fill in the details about the new webhook, ex.:
-
Click the Save button.
-
The new webhook is listed on the screen. Click the button with the three, vertical dots to make a menu appear. Click the Copy link menu item to copy the webhook's URL into the clipboard, ex.:
-
Visit the URL
https://github.com/<ORG_OR_USER>/<REPO_NAME>/settings/secrets/actions
to define a new repository secret by clicking on the New repository secret button, ex.: -
Name the new secret
GOOGLE_SPACE_URL
, paste the contents of the clipboard into the secret's value, and click the Add secret button, ex.: -
Create the directory structure
.github/workflows
in the target repository if it does not already exist. -
Copy the files
.github/workflows/gnotify.py
,.github/workflows/gnotify.requirements
, and.github/workflows/gnotify.yml
into the target repository's.github/workflows
directory. -
Commit the new files to the target repository and push the changes to the repository's main branch.
That's it! The next time someone creates an issue or pull request in the target repository, the Google Chat space will receive a notification!
If there are new comments, notifications will show up as a thread under the original message, ex.: