Skip to content

A middleware designed to sort your repository feeds into Discord forum posts. Built with Cloudflare Workers

License

Notifications You must be signed in to change notification settings

project-blurple/gitcord-forum

 
 

Repository files navigation

Deploy Linting DeepScan grade GitHub Issues GitHub Pull Requests

Gitcord Forum Deploy to Cloudflare Workers

A middleware designed to sort your repositories into forum posts.

Screenshot Image of the forum channel on Discord

Usage examples

  • If you have a lot of projects on your GitHub and you don't want to clog up one channel with all of it but you also don't want to create too many channels for all your repository feeds.

Setting up with Workers

  1. Deploy with Workers
  2. Insert the environment variables listed in the wrangler.toml file. You can either use the wrangler command, or do it through the worker dashboard.
  3. Add your new worker URL (https://gitcord-forum.WORKER_SUBDOMAIN.workers.dev/) as a webhook in your GitHub repository settings. Make sure to set content type to àpplication/json` and also match the secret you set in the environment variables.

How the middleware works

sequenceDiagram
    autonumber
    participant G as GitHub
    participant W as Cloudflare Worker & Storage
    participant D as Discord Webhook

    activate G
    G->>W: Send a Webhook event
    activate W

    alt signature header is not valid
        W->>G: 401 Unauthorized
    end

    alt event is not a repository event
        W->>G: 200 OK
    end

    W->>W: Find thread ID for repository

    alt no forum thread exists
        W->>D: Create a new forum thread and send first message
        D->>W: Return message data with thread ID
        W->>W: Save thread ID and message ID
    else forum thread exists
        W->>D: Update first forum message with new information
    end

    W->>D: Forward GitHub event to new or existing forum thread
    W->>G: 200 OK
Loading

About

A middleware designed to sort your repository feeds into Discord forum posts. Built with Cloudflare Workers

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%