[ADD] ci: Forgejo Actions CI and Claude bots ported from ecocentral

Same system as ecocentral-18 (see its docs/CI-CD.md):

- ci.yml: lint (pre-commit), test (tools/ci/run_tests.py, OCA-style
  two-phase install) and review (PR bot, after lint and test).
- issue-bot.yml: the issue bot answers issues or opens a PR on bot/issue-N.
- pr-bot.yml: review when WIP is removed or the i18n label is added.
- .gitea/issue-bot.md: context for the bots; this repo is shared by
  several clients.

The bot scripts are copies of ecocentral's. Only the defaults differ (repo,
token and state files, i18n languages es,eu,ca,gl) along with the [I18N]
commit message and the references to the runner's sources.txt.

The jobs run on a second forgejo-runner registration (CriptoMart org) on
ecocentral's runner machine, sharing its image, mounts and cache. The
runner files (Dockerfile, update.sh, sources.txt) live in ecocentral.
Specific to this repo:

- ODOO_SRC_SKIP: the runner's /odoo-src/18.0 holds a clone of addons-cm,
  so test skips it and checks the PR checkout instead.
- BOT_BASE_BRANCH "18.0": the repo's default branch is 16.0.
- test PostgreSQL on port 54330: ecocentral's runs on 54329 and a test job
  from each repo can run at the same time.

The lint job fails until the repo is cleaned up with
pre-commit run --all-files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GitHub Copilot 2026-10-04 14:14:22 +02:00
parent fad510f69e
commit d9d9e8be2d
Signed by: snt
GPG key ID: A9FD34930EADBE71
13 changed files with 2154 additions and 0 deletions

View file

@ -0,0 +1,40 @@
name: Bot de incidencias
run-name: "#${{ github.event.issue.number }} ${{ github.event.issue.title }}"
on:
issues:
types: [opened, reopened]
issue_comment:
types: [created]
jobs:
bot:
# Imagen propia con Claude Code y pre-commit ya instalados; el runner monta
# las fuentes de Odoo en /odoo-src. Ver tools/issue_bot/README.md.
runs-on: issue-bot
# Lo que publica la cuenta del bot también dispara el evento: sus respuestas
# y el eco de los correos de notificación. Se corta aquí; el resto de
# filtros (PR, cerradas, etiqueta no-bot) los aplica bot.py.
if: github.actor != 'claudia_eco'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# bot.py pone las credenciales de la cuenta del bot al hacer push.
persist-credentials: false
- name: Run bot
env:
# Con prefijo BOT_: el runner define sus propias FORGEJO_* y
# GITHUB_*, entre ellas un FORGEJO_TOKEN que no es de ningún usuario.
BOT_FORGEJO_URL: ${{ github.server_url }}
BOT_FORGEJO_REPO: ${{ github.repository }}
# La rama por defecto del repo es 16.0: sin esto el bot tomaría
# esa como base.
BOT_BASE_BRANCH: "18.0"
BOT_FORGEJO_TOKEN: ${{ secrets.BOT_FORGEJO_TOKEN }}
# Basta con uno de los dos.
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
BOT_REPO_DIR: ${{ github.workspace }}
# Dependencias del proyecto y, aparte, el resto de OCA.
BOT_ODOO_SRC: /odoo-src/18.0:/odoo-src/18.0-oca
run: python3 tools/issue_bot/bot.py run "${{ github.event.issue.number }}"