Publishes received webhooks from GitHub to a Google Cloud Pub/Sub topic.
This app is a straight-forward Probot application that does exactly what its description says and nothing more.
insert patrick-push-it-somewhere-else.gif meme
- Start a new Smee channel. This can be used to proxy GitHub webhooks to your local machine.
- Create a new GitHub App with the following settings:
- General
- Set Homepage URL to the Smee channel
- Set Webhook URL to the Smee channel
- Set Webhook Secret to any pin your choice
- Permissions
- None
- Events
- Subscribe to whichever choice events you want to publish
- General
- After creating the application, generate and download a private key. Also take note of the App ID.
- Install the application on a GitHub repository that you want to use for testing
- Create a Google Cloud project and add a Cloud Pub/Sub topic to it
- Authenticate your terminal session with
gcloud auth login
(make sure you have thegcloud
CLI installed)
- Clone this repository and cd into the
webhook-pubsub-publisher
directory. npm install
- Copy the
redacted.env
file to.env
and modify the fields based on the instructions in that file and the values from the GitHub App page:- The value for the
PRIVATE_KEY
field is a base64 representation of the.pem
file you downloaded from the GitHub App setup, Step 3. On Linux/Mac you can convert that file by runningcat private-key-file.pem | base64
in a command line. - The value for the
APP_ID
field is the App ID from GitHub App setup, Step 3. - Add
WEBHOOK_PROXY_URL={url of your Smee channel from GitHub App setup, Step 1}
.
- The value for the
npm run dev
If there are no errors after running the last command then the app is running locally on your machine.
This GitHub App is deployed as a Google Cloud Function at the endpoint: https://us-central1-amp-webhook-pubsub-publisher.cloudfunctions.net/webhook