Skip to content

r2cn-dev/r2cn-bot

r2cn-bot

A GitHub App built with Probot that A Probot app

Setup

# Install dependencies
npm install

# Run the bot
npm start

Environment variables

Values below follow docs/dual-webhook-scm-architecture.md (§6.3).

Backend API (required)

Variable Description
API_ENDPOINT Base URL of the r2cn HTTP API (e.g. http://r2cn-api:8000/api/v1).

GitHub / Probot (required for the current GitHub App)

Variable Description
APP_ID GitHub App ID
PRIVATE_KEY GitHub App private key (PEM)
WEBHOOK_SECRET Webhook signing secret
GITHUB_CLIENT_ID App OAuth client ID
GITHUB_CLIENT_SECRET App OAuth client secret

Atomgit (GitLab-compatible hooks + REST; stage 4)

Configure the repository webhook URL to POST https://<host>:<port>/webhooks/atomgit (same process as Probot; path is fixed).

Variable Description
ATOMGIT_WEBHOOK_SECRET Webhook secret: compared to X-Gitlab-Token / X-AtomGit-Token (default), or used for HMAC (see ATOMGIT_WEBHOOK_VERIFY_MODE). If unset, the route responds 200 with { ok: false } and does not process payloads (avoids retry storms).
ATOMGIT_WEBHOOK_VERIFY_MODE token (default) or hmac-sha256 (compare X-AtomGit-Signature / X-Gitlab-Signature as sha256=<hex> of raw body).
ATOMGIT_API_BASE REST root for OpenAPI calls, e.g. https://api.atomgit.com/api/v5. Writes: comments POST .../repos/:owner/:repo/issues/:number/comments; labels POST .../labels (JSON array of strings); close/reopen issue uses GET .../repos/:owner/:repo/issues/:number then PATCH .../repos/:owner/issues/:number with application/x-www-form-urlencoded (repo, title, body, `state=close
ATOMGIT_TOKEN Authorization: Bearer token for OpenAPI.
ATOMGIT_API_VERSION Optional; default 2023-02-21 (X-Api-Version header).
ATOMGIT_DEFAULT_BRANCH Optional; default main — used for getRepositoryContent raw file reads.

Payload mapping (see src/webhooks/map-atomgit-to-canonical.ts): Note Hook / object_kind: note on an IssueIssueCommentCreated; Issue HookIssueLabeled when (1) action: update and changes.labels has at least one new label, or (2) action: open and labels (on object_attributes or top-level issue) already include an r2cn-* score label (create-issue-with-labels). Other events are acknowledged with 200 and a debug log (no handler).

Config YAML: loadBotConfig still reads r2cn-dev/... via ScmClient.getRepositoryContent. On Atomgit-only installs, that path must exist on the same instance or you need a separate config strategy (docs §7).

Docker

# 1. Build container
docker build -t r2cn-bot .

# 2. Start container
docker run -e APP_ID=<app-id> -e PRIVATE_KEY=<pem-value> r2cn-bot

Contributing

If you have suggestions for how r2cn-bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.

For more, check out the Contributing Guide.

License

ISC © 2024 R2CN-DEV

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors