Skip to content

cerebruminc/svix-proxy-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

svix-proxy-action

Leverage Svix CLI's listen command to create a proxy to test webhooks inside your Github Action. This is useful for integration tests that want to create a webhook on a service (such as Svix) and test that postbacks work!

Usage

Create the following workflow in your repository:

./github/workflows/webhook-proxy.yml

name: Svix Proxy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Webhook Integration Tests
    steps:
      - uses: cerebruminc/svix-proxy-action@v1
        id: proxy
        with:
          port: 8080
      - name: Log URL to send webhook postbacks to
        run: |
          echo "Postback URL -> ${{ steps.proxy.outputs.postback_url }}"

This will provide a publicly available URL that you can set as your callback url so webhook systems can send their payloads to. In this example, the payloads will be proxied to localhost:8080 inside the action runner.

Inputs

Inputs are provided using the with: section of your workflow YML file.

key Description Required Default
port Localhost port to proxy traffic for true
path Path to include in proxied request false /
logging Enable proxy logs false false

logging will emit a URL in your action runner that you can visit to see requests sent to the postback URL.

path is used if your service expects webhooks to go to localhost:8080/webhooks for example. Otherwise, requests to the proxy URL will just go to localhost:8080/.

Outputs

key Description Type Example
postback_url Publicly accessible URL string https://play.svix.com/in/c_RGeO7pMi8XwtmannGw2a2qpJD26/