An IRC bot for Forgejo
irc
Find a file
2026-02-01 18:25:45 +01:00
ansi.go Initial commit 2026-01-01 15:30:09 +01:00
config.go Add exclude patterns 2026-01-03 22:30:00 +01:00
config_test.go Add exclude patterns 2026-01-03 22:30:00 +01:00
git.go Expand references in user IRC messages 2026-01-01 17:28:38 +01:00
gitea.go Add config directive for webhook auth token 2026-01-01 23:54:51 +01:00
go.mod Downgrade minimum Go version to 1.24 2026-01-01 15:36:58 +01:00
go.sum Initial commit 2026-01-01 15:30:09 +01:00
LICENSE Initial commit 2026-01-01 15:30:09 +01:00
main.go Sort older commits first for Git push notifications 2026-02-01 18:25:45 +01:00
README.md readme: expand description and add configuration section 2026-01-03 22:56:37 +01:00

nagjo

An IRC bot for Forgejo.

nagjo forwards events from Forgejo. For instance, it posts a message when a pull request is opened. The following events are supported:

  • Commits pushed
  • Issue opened or closed
  • Pull request opened, merged or closed
  • Release published

nagjo expands references to issues and pull requests in messages. For instance, posting fixed in #42 will reply with a link to that pull request. A repository name or path can be included as well, e.g. nagjo#42 or emersion/nagjo#42.

Usage

Create a configuration file:

listen localhost:8080
connect nagjo@irc.libera.chat

Run nagjo:

nagjo -config <path>

Configure your HTTP reverse proxy to forward requests to nagjo, then register a new webhook in the Forgejo project settings. Select the "Forgejo" webhook type and the events you're interested in.

Configuration

The scfg configuration file format is used.

connect <url>

Specifies IRC connection settings.

Example:

connect ircs://irc.libera.chat {
    nickname nagjo
    server-password hunter12
}

The URL follows one of these formats:

  • [ircs://]<host>[:port] connects with TLS over TCP
  • irc+insecure://<host>[:port] connects with plain-text TCP

The following directives are supported:

  • nickname <nick> specifies the nickname
  • server-password <pass> specifies the server password (PASS)

forgejo

Specifies Forgejo settings.

Example:

forgejo {
    base-url https://codeberg.org/emersion
    check-webhook-auth-token asdf
}

The following directives are supported:

  • base-url <url> specifies the base instance or user URL. Relative references in messages posted by users will be resolved relative to this base URL.
  • check-webhook-auth-token <token> verifies authentication for incoming webhook requests with a token. Configure the Forgejo webhook authentication header with Bearer <token>.

channel <name>

Per-channel configuration.

Example:

channel #nagjo {
    repository foo user/bar org/* !org/baz
}

The above matches any repository named "foo", any repository named "bar" owned by "user", and any repository owned by "org" which isn't named "baz".

The repository <patterns...> directive specifies which repositories should have their events sent to the channel. A pattern may be an absolute repository URL, a repository path (<owner>/<name>) or a repository name. A pattern may include * to match any path component. A pattern starting with ! excludes matching repositories.

If a channel is configured with a single repository, nagjo will expand issue and pull request references in messages when they do not contain a repository name.

License

GPLv3 only

© 2026 Simon Ser