Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 2.42 KB

File metadata and controls

56 lines (42 loc) · 2.42 KB

Webhook Pub/Sub Publisher

Publishes received webhooks from GitHub to a Google Cloud Pub/Sub topic.

How the app works

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

Local development

GitHub Application setup

  1. Start a new Smee channel. This can be used to proxy GitHub webhooks to your local machine.
  2. 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
  3. After creating the application, generate and download a private key. Also take note of the App ID.
  4. Install the application on a GitHub repository that you want to use for testing

Google Cloud setup

  1. Create a Google Cloud project and add a Cloud Pub/Sub topic to it
  2. Authenticate your terminal session with gcloud auth login (make sure you have the gcloud CLI installed)

Local setup

  1. Clone this repository and cd into the webhook-pubsub-publisher directory.
  2. npm install
  3. 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 running cat 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}.
  4. npm run dev

If there are no errors after running the last command then the app is running locally on your machine.

Deployment

This GitHub App is deployed as a Google Cloud Function at the endpoint: https://us-central1-amp-webhook-pubsub-publisher.cloudfunctions.net/webhook