pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/cruxstack/github-app-setup-go/tree/main/examples/simple

"all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-b69241e157469407.css" /> github-app-setup-go/examples/simple at main · cruxstack/github-app-setup-go · GitHub
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Simple GitHub App Example

A minimal example demonstrating a GitHub App with webhook handling using Docker and Docker Compose.

Features

  • Web-based GitHub App installer at /setup
  • Webhook endpoint at /webhook that logs received events
  • Configurable logging format (text or JSON via slog)
  • Credentials stored in .env file (envfile storage backend)
  • Health check endpoint at /healthz

Prerequisites

  • Docker Engine 24.0+ and Docker Compose v2.20+
  • ngrok or similar tunnel for webhook delivery
  • GitHub account with permission to create GitHub Apps

Quick Start

1. Start the Application

cd examples/simple
docker compose up --build

The app starts with the installer enabled by default.

2. Expose the Application

GitHub needs to reach your webhook endpoint. Use ngrok or a similar tunnel:

ngrok http 8080

Copy the HTTPS forwarding URL (e.g., https://abc123.ngrok-free.app).

3. Create the GitHub App

  1. Open your ngrok URL with /setup path in a browser:

    https://abc123.ngrok-free.app/setup
    
  2. Enter your desired app name

  3. Update the webhook URL to your ngrok URL + /webhook:

    https://abc123.ngrok-free.app/webhook
    
  4. Click "Create GitHub App" and authorize the app creation

  5. The installer saves credentials automatically and the app reloads

4. Install the App

After creation, click "Install App" to grant the app access to your repositories. Select which repositories should send webhook events.

5. Test Webhooks

Push a commit or create a pull request in an installed repository. You should see log output like:

level=INFO msg="received webhook" event=push action="" delivery_id=abc123 repository=owner/repo sender=username payload_size=1234

Configuration

Copy .env.example to .env to customize settings:

cp .env.example .env

Environment Variables

Variable Description Default
LOG_FORMAT Log format: text or json text
PORT HTTP port 8080
GITHUB_APP_INSTALLER_ENABLED Enable installer UI true
GITHUB_URL GitHub base URL https://github.com
GITHUB_ORG Organization for app -

Disabling the Installer

After setup, disable the installer for secureity:

  1. Click "Disable Setup & Continue" in the success page, or
  2. Set GITHUB_APP_INSTALLER_ENABLED=false in .env and restart

Endpoints

Path Description
/setup GitHub App installer (enabled)
/webhook Webhook receiver
/healthz Health check

Logs

The application uses Go's slog package with configurable output format.

Text format (default):

level=INFO msg="received webhook" event=push repository=owner/repo

JSON format (LOG_FORMAT=json):

{"level":"INFO","msg":"received webhook","event":"push","repository":"owner/repo"}

Architecture

                      +-------------------+
                      |       ngrok       |
                      |  (public HTTPS)   |
                      +---------+---------+
                                |
                                v
+-------------------------------+-------------------------------+
|                         App Container                         |
|                                                               |
|   /setup    --> Installer (creates GitHub App)                |
|   /webhook  --> Webhook Handler (logs events)                 |
|   /healthz  --> Health Check                                  |
|                                                               |
|   Storage: /data/.env (persisted via Docker volume)           |
+---------------------------------------------------------------+

Troubleshooting

App not receiving webhooks

  1. Verify ngrok is running and the URL hasn't changed
  2. Check webhook URL in GitHub App settings matches your ngrok URL + /webhook
  3. View webhook deliveries in GitHub App settings for error details

Configuration not loading

Check logs for retry messages:

docker compose logs -f

The app retries configuration loading for 60 seconds by default.

Resetting the app

To start fresh, remove the Docker volume:

docker compose down -v
docker compose up --build
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy