gitea_action
Interact with a self-hosted Gitea forge REST API to read and edit repositories, branches, files, commits, pull requests, issues, workflow runs, and push mirrors.
Instructions
Interact with the self-hosted Gitea forge REST API: read repos, branches, files, and commits, read Forge Actions runs, jobs, and job logs (to find why a check failed), create branches, single-file commits, and literal find/replace edits to part of a file, open/read/merge/close pull requests, comment, manage issues, and manage push mirrors so the forge owns downstream syncs (for example a calm scheduled mirror to GitHub). To run a few test files on a branch without waiting on full CI: create_test_run(owner, repo, ref, files) dispatches .gitea/workflows/quick-test.yml and returns its run id (each dispatch gets its own request_id, even when you pass one as a label, so concurrent runs never get mixed up). Then get_test_results(owner, repo, run_id) polls status, conclusion, and the last 80 log lines; pass request_id instead of run_id if create_test_run reported the run was not visible yet.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | Branch, tag, or commit for get_file, get_commit_status, or create_test_run (the branch/sha to check out and test). | |
| sha | No | Commit SHA for get_commit. | |
| base | No | Pull request base branch. | |
| body | No | Issue, pull request, or comment body text. | |
| head | No | Pull request head branch. | |
| page | No | Page number. | |
| path | No | Repo-relative file path for get_file, upsert_file, and write_file_edits. | |
| repo | No | Repository name. | |
| edits | No | write_file_edits: 1 to 50 { find, replace } edits, applied in order as literal text (never a regex; a "$" in replace is inserted literally). Each find is matched against the file as last read (after any earlier edits in this same call already applied) and must match exactly once, or the whole call is refused before anything is written. | |
| files | No | create_test_run: test file paths to run, as an array or a space-separated string (each *.test.ts, *.test.tsx or *.test.mjs; at most 20). | |
| index | No | Issue or pull request number (Gitea's own field name). Synonym for issue_number/pull_number/number on comment_issue_or_pr, merge_pull_request, close_pull_request, get_pull_request, and get_pull_request_files. | |
| limit | No | list_action_runs (or list_workflow_runs): runs to return (default 20, max 50). | |
| owner | No | Repository owner login. | |
| query | No | Search query string (for search_repos). | |
| state | No | Filter by state: open, closed, all. | |
| title | No | Issue or pull request title. | |
| action | Yes | Action: get_version, search_repos, get_repo, list_branches, create_branch, get_file, get_commit_status, get_commit, list_action_runs, list_workflow_runs (alias of list_action_runs), list_run_jobs, get_job_log, create_test_run (dispatch quick-test.yml on a branch), get_test_results (poll a create_test_run run), upsert_file (replace a whole file's contents), write_file_edits (change part of a file: 1-50 literal find/replace edits, each find must match exactly once; aliases patch_file, replace_in_file, str_replace), list_issues, create_issue, comment_issue_or_pr, comment (alias of comment_issue_or_pr), list_prs, get_pull_request, get_pull_request_files, create_pr (alias of create_pull_request), create_pull_request, merge_pull_request, close_pull_request, get_user, list_push_mirrors, add_push_mirror, delete_push_mirror, sync_push_mirrors. | |
| branch | No | Target branch for branch creation, upsert_file, or pull requests; list_action_runs branch filter. Required for write_file_edits. | |
| job_id | No | get_job_log: Forge Actions job id (from list_run_jobs). | |
| number | No | Issue or pull request number fallback. | |
| run_id | No | list_run_jobs, get_test_results: Forge Actions run id (from list_action_runs or create_test_run). | |
| status | No | list_action_runs (or list_workflow_runs): filter runs by status, for example queued, in_progress, success, failure. | |
| api_key | No | Gitea token fallback. Saved UnClick Gitea login is preferred when omitted. | |
| comment | No | Comment body fallback for comment_issue_or_pr. | |
| content | No | UTF-8 file content for upsert_file (replaces the whole file). | |
| message | No | Commit message for upsert_file or write_file_edits. | |
| base_url | No | Forge base URL, for example https://git.unclick.world or http://localhost:3300. Saved UnClick Gitea login or GITEA_BASE_URL is used when omitted. | |
| end_line | No | get_file: last line to return (inclusive). Omit for end of file; the byte cap may trim earlier (truncated: true + next_start_line). | |
| head_sha | No | list_action_runs (or list_workflow_runs): only runs for this commit sha. | |
| interval | No | Push mirror sync interval, for example 1h0m0s. Defaults to 8h0m0s. | |
| per_page | No | Results per page (max 50). | |
| username | No | Gitea username (for get_user). | |
| max_bytes | No | get_file: response size cap in bytes (default 10000, clamped 256-100000). Slices always end on whole lines. | |
| expect_sha | No | write_file_edits: optional. Refuse with no write if the file's current sha does not match this (the sha the seat last read the file at). | |
| new_branch | No | New branch name for create_branch, or the branch upsert_file should create. | |
| request_id | No | create_test_run: optional label for this run; the tool always adds a unique suffix (or makes a random UUID when omitted) and returns the full request_id, so a reused label never matches an older run. get_test_results: the full request_id create_test_run returned, as an alternative to run_id, for polling a run that was not visible yet right after dispatch. | |
| start_line | No | get_file: first line to return (1-based, default 1). Every response reports total_lines, total_bytes, truncated, and next_start_line so you can walk a big file in slices. | |
| tail_lines | No | get_job_log: trailing log lines to return (default 200, max 2000). Output is capped near 60,000 characters and secrets are redacted. | |
| base_branch | No | Base branch for create_branch or pull requests. Defaults to main. | |
| errors_only | No | get_job_log: return only the matched error lines (no tail). Defaults to false. | |
| mirror_name | No | Mirror remote_name for delete_push_mirror (from list_push_mirrors). | |
| pull_number | No | Pull request number for comment_issue_or_pr, merge_pull_request, close_pull_request, get_pull_request, or get_pull_request_files. | |
| access_token | No | Gitea access token. Saved UnClick Gitea login is used when this is omitted. | |
| commit_title | No | Merge commit title. | |
| issue_number | No | Issue number for comment_issue_or_pr. | |
| merge_method | No | Merge method: merge, squash, rebase, or rebase-merge. Defaults to squash. | |
| delete_branch | No | Delete the head branch after merging. Defaults to false. | |
| commit_message | No | Merge commit message. | |
| remote_address | No | Downstream clone URL for add_push_mirror, for example https://github.com/owner/repo.git. | |
| sync_on_commit | No | Sync the push mirror on every commit. Defaults to false to keep downstream activity calm. | |
| remote_password | No | Token or password for the push mirror remote. | |
| remote_username | No | Username for the push mirror remote. |