Simple webhook that converts Forgejo-esque events to GitHub Actions-compatible dispatches
  • Python 95.9%
  • HTML 2.8%
  • Shell 1.3%
Find a file
crueter 67875a3e11
mor readme
Signed-off-by: crueter <crueter@eden-emu.dev>
2025-12-02 03:37:52 -05:00
dist real security 2025-12-02 03:31:29 -05:00
img real security 2025-12-02 03:31:29 -05:00
templates require FORGEJO_SECRET, add index template 2025-12-02 02:40:18 -05:00
.env.example Init 2025-09-16 20:10:49 -04:00
.gitignore real security 2025-12-02 03:31:29 -05:00
LICENSE Init 2025-09-16 20:10:49 -04:00
main.py oops 2025-12-02 03:36:00 -05:00
README.md mor readme 2025-12-02 03:37:52 -05:00
requirements.txt real security 2025-12-02 03:31:29 -05:00
tokens.py.example real security 2025-12-02 03:31:29 -05:00
webhook.sh real security 2025-12-02 03:31:29 -05:00

fj2ghook

Simple webhook that converts Forgejo-esque events to GitHub Actions-compatible dispatches.

Setup

Setup requires six things:

  • An existing HTTP server, such as nginx
  • A GitHub account (preferably a "dummy")
  • A random password, or "secret"
  • A Forgejo repository with webhooks
  • A GitHub repository to dispatch events to
  • A Personal Access Token for your GitHub account with dispatch permission on that repository

Setup a "Forgejo" webhook in your Forgejo repository.

  • URL should be https://<your webhook domain>/forgejo/<GITHUB_OWNER>/<GITHUB_REPO>/<EVENT_TYPE>
  • Secret should be your randomly generated password
  • Authorization header is unused
    • You may optionally modify this to include another "secret" that gets verified during the workflow run.

webhook example

By default, the script handles master, pull_request, and tag events.

  • master: Push events -> master
  • tag: Custom events... -> Repository events -> Create
  • pull_request: Custom events... -> Pull request events -> Modification, Synchronized

Now, set up your GitHub repository. The setup and structure is up to the user, but you can see the QDash CI for an example; take particular note of the parse script.

Once that's done, copy .env.example to .env and replace verySecretPassword with your Forgejo secret. Copy tokens.py.example to tokens.py and create your token mappings. Run the webhook.sh script with your preferred process manager, be it systemd, openrc, or pm2, and your webhook is now online.

To expose it to the outside world, use the provided dist/fj2ghook.nginx script to proxy traffic to port 17001 (or whatever you configure it to in .env). Set up https through certbot, and you should be good to go! Quickly test by going to https://webhook.my.domain/forgejo to ensure fj2ghook is running. If your CI repository is set up, go to the master webhook and click Test delivery to test out your workflow.