Integrates the tea Gitea CLI tool for Gitea API interactions in CI scripts, replacing direct HTTP API calls with a Python wrapper around the official CLI.
Changes
New Files
scripts/gitea_cli.py — Python wrapper around tea CLI with TeaCLI class for issues, labels, PRs, releases, reviews, and branches
tests/unit/test_gitea_cli.py — Comprehensive unit tests (100% coverage)
scripts/setup.py — Added _configure_tea_login() to configure tea login from .envREPO_TOKEN
scripts/ci/review_pr.py — Refactored to post reviews via tea pulls review instead of GiteaClient.create_review
scripts/ci/publish.py — Refactored to create releases via tea releases create instead of GiteaClient.create_release_idempotent
scripts/ci/notify_failure.py — Refactored to create issues via tea issues create with fallback to GiteaClient when tea is not installed
scripts/configure_repo.py — Refactored to create labels via tea labels create with fallback to GiteaClient; branch protection still uses GiteaClient (tea only supports basic protect/unprotect)
.gitea/workflows/publish.yml — Install tea, configure login, use PYTHONPATH: .:src
.gitea/workflows/post-merge.yml — Updated notify_failure.py PYTHONPATH to .:src
Test Updates
All test files updated to mock TeaCLI instead of GiteaClient where applicable
New tests for _configure_tea_login() in test_setup.py
New test for multiple --tool option in test_install_tools.py
All 838 tests pass with 100% coverage
Design Decisions
Fallback strategy: notify_failure.py and configure_repo.py fall back to GiteaClient when tea is not available or fails — this ensures robustness in CI environments where tea might not be installed
No fallback for review_pr.py and publish.py: These scripts are only run in workflows where tea is explicitly installed, so no fallback is needed
Branch protection stays on GiteaClient: tea only supports basic protect/unprotect, not the detailed config we need (status checks, required approvals, etc.)
PYTHONPATH: .:src: Scripts that import from both gitea_runner_manager and scripts.gitea_cli need both paths
Closes GRM-54
## Summary
Integrates the `tea` Gitea CLI tool for Gitea API interactions in CI scripts, replacing direct HTTP API calls with a Python wrapper around the official CLI.
## Changes
### New Files
- `scripts/gitea_cli.py` — Python wrapper around `tea` CLI with `TeaCLI` class for issues, labels, PRs, releases, reviews, and branches
- `tests/unit/test_gitea_cli.py` — Comprehensive unit tests (100% coverage)
### Modified Files
- `scripts/install_tools.py` — Added `tea` CLI installation (v0.14.1); `--tool` option now supports multiple values
- `scripts/setup.py` — Added `_configure_tea_login()` to configure tea login from `.env` `REPO_TOKEN`
- `scripts/ci/review_pr.py` — Refactored to post reviews via `tea pulls review` instead of `GiteaClient.create_review`
- `scripts/ci/publish.py` — Refactored to create releases via `tea releases create` instead of `GiteaClient.create_release_idempotent`
- `scripts/ci/notify_failure.py` — Refactored to create issues via `tea issues create` with fallback to `GiteaClient` when tea is not installed
- `scripts/configure_repo.py` — Refactored to create labels via `tea labels create` with fallback to `GiteaClient`; branch protection still uses `GiteaClient` (tea only supports basic protect/unprotect)
- `AGENTS.md` — Documented tea CLI integration, updated PYTHONPATH table
- `.gitea/workflows/publish.yml` — Install tea, configure login, use `PYTHONPATH: .:src`
- `.gitea/workflows/post-merge.yml` — Updated `notify_failure.py` PYTHONPATH to `.:src`
### Test Updates
- All test files updated to mock `TeaCLI` instead of `GiteaClient` where applicable
- New tests for `_configure_tea_login()` in `test_setup.py`
- New test for multiple `--tool` option in `test_install_tools.py`
- All 838 tests pass with 100% coverage
## Design Decisions
1. **Fallback strategy**: `notify_failure.py` and `configure_repo.py` fall back to `GiteaClient` when tea is not available or fails — this ensures robustness in CI environments where tea might not be installed
2. **No fallback for `review_pr.py` and `publish.py`**: These scripts are only run in workflows where tea is explicitly installed, so no fallback is needed
3. **Branch protection stays on `GiteaClient`**: tea only supports basic protect/unprotect, not the detailed config we need (status checks, required approvals, etc.)
4. **`PYTHONPATH: .:src`**: Scripts that import from both `gitea_runner_manager` and `scripts.gitea_cli` need both paths
Closes GRM-54
## Automated PR Review
- Architecture compliance: OK
- Best practices: OK
- Security: OK
- Documentation: OK
- Tests: OK
- Commit conventions: OK
No issues found by automated checks.
---
**Manual review required:** Before approving, review every category in
[REVIEW_CHECKLIST.md](REVIEW_CHECKLIST.md) and confirm with:
```bash
python3 scripts/ci/review_pr.py <PR> <owner/repo> \
--event APPROVE --checklist-confirmed \
--body "<substantive review summary>"
```
emil
merged commit 28dc6dcf86 into master2026-06-22 07:04:59 +00:00
emil
deleted branch GRM-54-gitea-cli-integration2026-06-22 07:04:59 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Integrates the
teaGitea CLI tool for Gitea API interactions in CI scripts, replacing direct HTTP API calls with a Python wrapper around the official CLI.Changes
New Files
scripts/gitea_cli.py— Python wrapper aroundteaCLI withTeaCLIclass for issues, labels, PRs, releases, reviews, and branchestests/unit/test_gitea_cli.py— Comprehensive unit tests (100% coverage)Modified Files
scripts/install_tools.py— AddedteaCLI installation (v0.14.1);--tooloption now supports multiple valuesscripts/setup.py— Added_configure_tea_login()to configure tea login from.envREPO_TOKENscripts/ci/review_pr.py— Refactored to post reviews viatea pulls reviewinstead ofGiteaClient.create_reviewscripts/ci/publish.py— Refactored to create releases viatea releases createinstead ofGiteaClient.create_release_idempotentscripts/ci/notify_failure.py— Refactored to create issues viatea issues createwith fallback toGiteaClientwhen tea is not installedscripts/configure_repo.py— Refactored to create labels viatea labels createwith fallback toGiteaClient; branch protection still usesGiteaClient(tea only supports basic protect/unprotect)AGENTS.md— Documented tea CLI integration, updated PYTHONPATH table.gitea/workflows/publish.yml— Install tea, configure login, usePYTHONPATH: .:src.gitea/workflows/post-merge.yml— Updatednotify_failure.pyPYTHONPATH to.:srcTest Updates
TeaCLIinstead ofGiteaClientwhere applicable_configure_tea_login()intest_setup.py--tooloption intest_install_tools.pyDesign Decisions
notify_failure.pyandconfigure_repo.pyfall back toGiteaClientwhen tea is not available or fails — this ensures robustness in CI environments where tea might not be installedreview_pr.pyandpublish.py: These scripts are only run in workflows where tea is explicitly installed, so no fallback is neededGiteaClient: tea only supports basic protect/unprotect, not the detailed config we need (status checks, required approvals, etc.)PYTHONPATH: .:src: Scripts that import from bothgitea_runner_managerandscripts.gitea_clineed both pathsCloses GRM-54
Automated PR Review
No issues found by automated checks.
Manual review required: Before approving, review every category in
REVIEW_CHECKLIST.md and confirm with: