fix: remove Gitea Actions agent workflows (agents run locally, not in CI)
This commit is contained in:
@@ -1,38 +0,0 @@
|
|||||||
name: Agent Batch Merge
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
branches:
|
|
||||||
description: "Comma-separated branches to merge (e.g., fix/a,fix/b)"
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
batch-merge:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: gitea.tap-tap.win/taptap/fastsync-ci:v9
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: dev
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Merge all branches
|
|
||||||
run: |
|
|
||||||
IFS=',' read -ra BRANCHES <<< "${{ github.event.inputs.branches }}"
|
|
||||||
for branch in "${BRANCHES[@]}"; do
|
|
||||||
branch=$(echo "$branch" | xargs)
|
|
||||||
git fetch origin "$branch"
|
|
||||||
git merge "origin/$branch" --no-edit || true
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Build and test
|
|
||||||
run: |
|
|
||||||
cmake -B build -S . && cmake --build build -j$(nproc)
|
|
||||||
./build/tests
|
|
||||||
python3 -m pytest tests/ -v --tb=short
|
|
||||||
|
|
||||||
- name: Commit and push
|
|
||||||
run: |
|
|
||||||
git add -A
|
|
||||||
git commit -m "batch-merge: ${{ github.event.inputs.branches }}" || true
|
|
||||||
git push origin dev
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
name: Agent Issue Fix
|
|
||||||
on:
|
|
||||||
issue_comment:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
fix:
|
|
||||||
if: contains(github.event.comment.body, '/opencode fix')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: gitea.tap-tap.win/taptap/fastsync-ci:v9
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: dev
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install opencode
|
|
||||||
run: npm install -g opencode-ai
|
|
||||||
|
|
||||||
- name: Create fix branch and implement
|
|
||||||
run: |
|
|
||||||
ISSUE_NUM="${{ github.event.issue.number }}"
|
|
||||||
BRANCH="auto-fix/issue-${ISSUE_NUM}"
|
|
||||||
git checkout -b "$BRANCH" origin/dev
|
|
||||||
opencode run \
|
|
||||||
"Fix this issue: ${{ github.event.issue.body }}"
|
|
||||||
git add -A
|
|
||||||
git commit -m "auto-fix: address issue #${ISSUE_NUM}" || true
|
|
||||||
git push origin "$BRANCH"
|
|
||||||
|
|
||||||
- name: Create PR
|
|
||||||
run: |
|
|
||||||
ISSUE_NUM="${{ github.event.issue.number }}"
|
|
||||||
TITLE="${{ github.event.issue.title }}"
|
|
||||||
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{
|
|
||||||
\"title\": \"Fix: ${TITLE:0:80}\",
|
|
||||||
\"body\": \"Automated fix for issue #${ISSUE_NUM}\n\nCloses #${ISSUE_NUM}\",
|
|
||||||
\"head\": \"auto-fix/issue-${ISSUE_NUM}\",
|
|
||||||
\"base\": \"dev\"
|
|
||||||
}" \
|
|
||||||
"https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/pulls"
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
name: Agent Scheduled Maintenance
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 6 * * 1"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
audit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: gitea.tap-tap.win/taptap/fastsync-ci:v9
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
ref: dev
|
|
||||||
|
|
||||||
- name: Install opencode
|
|
||||||
run: npm install -g opencode-ai
|
|
||||||
|
|
||||||
- name: Security audit
|
|
||||||
run: |
|
|
||||||
opencode run --agent security-auditor \
|
|
||||||
"Audit the codebase for vulnerabilities. Create issues for any findings via the Gitea API at https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues using token ${{ secrets.GITEA_TOKEN }}"
|
|
||||||
|
|
||||||
- name: Code quality scan
|
|
||||||
run: |
|
|
||||||
opencode run --agent code-quality-guardian \
|
|
||||||
"Scan for code quality issues. Create issues for any findings via the Gitea API at https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues using token ${{ secrets.GITEA_TOKEN }}"
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
name: Agent PR Review
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, ready_for_review]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
review:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: gitea.tap-tap.win/taptap/fastsync-ci:v9
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install opencode
|
|
||||||
run: npm install -g opencode-ai
|
|
||||||
|
|
||||||
- name: Run security audit review
|
|
||||||
run: |
|
|
||||||
opencode run --agent security-auditor \
|
|
||||||
"Review this PR for security vulnerabilities" \
|
|
||||||
> /tmp/security-review.md 2>&1 || true
|
|
||||||
|
|
||||||
- name: Run code quality review
|
|
||||||
run: |
|
|
||||||
opencode run --agent code-quality-guardian \
|
|
||||||
"Review this PR for code quality issues" \
|
|
||||||
> /tmp/quality-review.md 2>&1 || true
|
|
||||||
|
|
||||||
- name: Post combined review
|
|
||||||
run: |
|
|
||||||
{
|
|
||||||
echo "## Agent Review Report"
|
|
||||||
echo ""
|
|
||||||
echo "### Security Audit"
|
|
||||||
cat /tmp/security-review.md 2>/dev/null || echo "No security issues found."
|
|
||||||
echo ""
|
|
||||||
echo "### Code Quality"
|
|
||||||
cat /tmp/quality-review.md 2>/dev/null || echo "No quality issues found."
|
|
||||||
} > /tmp/full-review.md
|
|
||||||
curl -s -X POST -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$(jq -Rs '{body: .}' < /tmp/full-review.md)" \
|
|
||||||
"https://gitea.tap-tap.win/api/v1/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
|
|
||||||
@@ -2,7 +2,7 @@ name: CI
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [dev, main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -125,40 +125,56 @@ git push origin dev
|
|||||||
|
|
||||||
## Automated Agent Workflows
|
## Automated Agent Workflows
|
||||||
|
|
||||||
When a PR targeting `dev` is opened or synchronized, Gitea Actions workflows automatically run agents to review the code and post results as PR comments. This replaces the manual "invoke 3 reviewers" pattern.
|
All agents run locally via the opencode CLI. There is no CI-based agent automation — agents are invoked on-demand by the developer or by this assistant.
|
||||||
|
|
||||||
### Automated PR Review
|
### One-command batch workflow
|
||||||
Triggered on `pull_request: [opened, synchronize, ready_for_review]`. Runs security-auditor and code-quality-guardian, posts combined review to PR.
|
|
||||||
|
|
||||||
### Automated Issue Fix
|
For fixing a set of issues and creating one integration PR:
|
||||||
Comment `/opencode fix` on any issue — agents will create a fix branch, implement the fix, and open a PR targeting `dev`.
|
|
||||||
|
|
||||||
### Scheduled Maintenance
|
|
||||||
Runs weekly (Monday 06:00 UTC) — security audit of the full codebase, creates issues for findings.
|
|
||||||
|
|
||||||
### Batch Merge Orchestration
|
|
||||||
For grouping multiple fixes into one integration PR (like the `integration/all-fixes` pattern):
|
|
||||||
1. Push each fix branch independently (targetting `dev`)
|
|
||||||
2. Use `workflow_dispatch` on `agent-batch-merge.yml` with comma-separated branch names
|
|
||||||
3. The workflow merges all branches into `dev`, resolves conflicts, runs build + tests, and pushes
|
|
||||||
|
|
||||||
## Manual PR Invocation
|
|
||||||
|
|
||||||
When automated agents are unavailable or you need a targeted review, invoke agents directly:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run all 3 reviewers on a PR diff
|
# 1. Run each subagent on its category
|
||||||
opencode run --agent reviewer "Review this PR"
|
opencode run --agent security-auditor "Fix all open security issues"
|
||||||
opencode run --agent security-auditor "Audit this PR for vulnerabilities"
|
opencode run --agent debugger "Fix all open bugs"
|
||||||
opencode run --agent code-quality-guardian "Check this PR for code quality"
|
opencode run --agent test-writer "Add missing test coverage"
|
||||||
|
|
||||||
# Post results to Gitea
|
# 2. The assistant handles: merging branches, fixing CI failures,
|
||||||
curl -s -X POST -H "Authorization: token $TOKEN" \
|
# pushing, creating the integration PR, waiting for CI, iterating.
|
||||||
-H "Content-Type: application/json" \
|
# The developer only reviews the final PR.
|
||||||
-d '{"body":"MARKDOWN_REVIEW_BODY"}' \
|
|
||||||
"https://gitea.tap-tap.win/api/v1/repos/TapTap/FastSync/issues/<PR_NUMBER>/comments"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Issue triage loop
|
||||||
|
When you want to fix a batch of issues autonomously:
|
||||||
|
|
||||||
|
1. Tell the assistant: *"Fix all open issues and create one big PR"*
|
||||||
|
2. The assistant delegates to subagents in parallel
|
||||||
|
3. Merges their branches, handles CI failures iteratively
|
||||||
|
4. Pushes and opens the final PR
|
||||||
|
5. You review the PR once CI passes — no intermediate check-ins
|
||||||
|
|
||||||
|
### Scheduling
|
||||||
|
For periodic maintenance (security audits, code quality scans), run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
opencode run --agent security-auditor "Audit the codebase for vulnerabilities"
|
||||||
|
opencode run --agent code-quality-guardian "Scan for code quality issues"
|
||||||
|
```
|
||||||
|
|
||||||
|
This can be cron'd locally if desired (e.g., `crontab -e` with `opencode run`).
|
||||||
|
|
||||||
|
## Is opencode a good option?
|
||||||
|
|
||||||
|
**Yes, for FastSync's needs.** The hybrid model works well:
|
||||||
|
- opencode's 17 specialized agents handle deep code analysis, fixes, tests, and reviews
|
||||||
|
- The assistant orchestrates subagents, merges branches, and iterates on CI
|
||||||
|
- You only review the final output
|
||||||
|
|
||||||
|
The key limitation: opencode is session-based, not a persistent daemon. But for the "fix all issues, one PR" workflow, this is fine — the assistant runs the full pipeline in one shot. Persistent webhook-driven automation isn't available for Gitea, but the one-shot batch approach is simpler and gives you full control over what gets merged.
|
||||||
|
|
||||||
|
### Recommendations for this project
|
||||||
|
- **Do** use the batch pattern: delegate to subagents, let the assistant merge + iterate CI, review once
|
||||||
|
- **Don't** try to run opencode in Gitea Actions — the CI container doesn't have your LLM keys or the interactive context agents need
|
||||||
|
- **If** you want fully hands-off periodic scans, set up a local cron job or systemd timer that runs `opencode run` and posts results to Gitea via API
|
||||||
|
|
||||||
## Gitea API & tea CLI
|
## Gitea API & tea CLI
|
||||||
|
|
||||||
### Check CI status via API
|
### Check CI status via API
|
||||||
|
|||||||
Reference in New Issue
Block a user