tea pr: Create and List Gitea Pull Requests
tea pr create opens a pull request on a Gitea or Forgejo instance from the command line.
Once tea login is set up, tea pr is how you open, list, and merge pull requests against a self-hosted Gitea or Forgejo repo inside a pipeline.
What it does
tea pr groups pull-request operations. create opens a PR from a head branch into a base branch, list shows open PRs, and merge merges one by index using a chosen strategy.
Common usage
# open a PR from the current branch
tea pr create --repo owner/repo \
--head feature-x --base main --title "Add feature X"
# list open PRs, merge one non-interactively
tea pr list --repo owner/repo
tea pr merge 42 --repo owner/repo --style squashOptions
| Flag | What it does |
|---|---|
| --repo owner/repo | Target repository |
| --head <branch> | Source branch for the PR |
| --base <branch> | Target branch (default the repo default) |
| --title <t> | PR title (avoids the interactive prompt) |
| --description <d> | PR body |
| --login <name> | Which configured login to use |
| --style <s> | Merge style: merge, rebase, squash (with tea pr merge) |
In CI
Pass --title (and --repo, --head, --base) so create runs without prompts. If you configured multiple tea logins, pass --login to pin the right instance rather than relying on the default.
Common errors in CI
"Error: Please specify a repo" means --repo was omitted and tea could not infer it from the remote. "422 Unprocessable Entity" on create usually means a PR already exists for that head/base or the head branch was not pushed. "401 Unauthorized" means the login token is invalid. "unknown login" means the --login name is not registered.
Using this in CI
CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.
- uses: actions/checkout@v4
with:
fetch-depth: 0 # history, tags, and git describe all need this
- run: |
git rev-parse --is-shallow-repository # expect false
git rev-parse --abbrev-ref HEAD # prints HEAD when detached