forgejo API and command line tools
Mark Wielaard
mark@klomp.org
Mon Nov 11 22:10:16 GMT 2024
Hi,
During the meeting Friday we briefly talked about the Forgejo API
https://forge.sourceware.org/api/swagger You should be able to do
anything through the api that you can do through the webapp.
There are some command line tools that use this API. One of them "tea"
seems specific for gitea/forgejo and does let you create and review
pull requests from the command line. It works a bit like git-pw for
patchwork. https://gitea.com/gitea/tea
$ tea login add
# url https://forge.sourceware.org
# user yourname
# scopes all (but you can restrict what you can do with a token)
$ tea repo fork --repo binutils-gdb/binutils-gdb-test
# Assuming you already have a binutils-gdb git repo locally
# Just add the forge as new remote
$ git remote add forge git@forge.sourceware.org:mjw/binutils-gdb-test.git
# Start at the fork
$ git checkout forge/master
$ git checkout -b cool-hack
# hack, hack, hack, git commit, etc.
$ git push -u forge cool-hack
# Turn current branch into a pull request
$ tea pull create --repo binutils-gdb/binutils-gdb-test
# If you forgot which pull ids there where
$ tea pull ls --repo binutils-gdb/binutils-gdb-test
# Comment on a pull request (assume 3 is the id)
$ tea comment --repo binutils-gdb/binutils-gdb-test 3 "Your quick comment"
# Review a pull request
$ tea pull review --repo binutils-gdb/binutils-gdb-test 3
# Note that the review comments should all be behind a #...
# and there should be no extra newlines. You'll get a buffer with
# instructions.
It is all still very bare bones. But I saw there is also an emacs mode
(which doesn't fully supports forgejo, but hopefully soon).
https://magit.vc/manual/forge.html
Although the current tools to work with the API aren't very
sophisticated they should let us script everything you can do through
the webapp interface.
Cheers,
Mark
More information about the Forge
mailing list